network icon indicating copy to clipboard operation
network copied to clipboard

Report host/port in connect exception message

Open yaitskov opened this issue 4 years ago • 2 comments

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

yaitskov avatar Jul 15 '20 17:07 yaitskov

Could you implement it by yourself and send us a PR?

kazu-yamamoto avatar Jul 16 '20 04:07 kazu-yamamoto

https://github.com/haskell/network/pull/529

yaitskov avatar Apr 20 '22 04:04 yaitskov