network
network copied to clipboard
Report host/port in connect exception message
Hi,
I propose to append target address to exception message in connect function. Haskell doesn't have stack trace support as good as java. It is really hard to figure out where a problem is if an application connects to many places, because an exception message doesn't have target domain/ip address and port.
connectLoop :: SocketAddress sa => Socket -> Ptr sa -> CInt -> IO ()
connectLoop s p_sa sz = withFdSocket s $ \fd -> loop fd
where
errLoc = "Network.Socket.connect: " ++ show s
Could you implement it by yourself and send us a PR?
https://github.com/haskell/network/pull/529