diff --git a/Network/Socket/Info.hsc b/Network/Socket/Info.hsc index 12343ce0..31d1062a 100644 --- a/Network/Socket/Info.hsc +++ b/Network/Socket/Info.hsc @@ -272,8 +272,17 @@ getAddrInfo hints node service = withSocketsDo $ c_freeaddrinfo ptr_addrs return ais _ -> do err <- gai_strerror ret + let message = mconcat + [ "Network.Socket.getAddrInfo (called with preferred socket type/protocol: " + , show hints + , ", host name: " + , show node + , ", service name: " + , show service + , ")" + ] ioError (ioeSetErrorString - (mkIOError NoSuchThing "Network.Socket.getAddrInfo" Nothing + (mkIOError NoSuchThing message Nothing Nothing) err) -- Leaving out the service and using AI_NUMERICSERV causes a -- segfault on OS X 10.8.2. This code removes AI_NUMERICSERV @@ -354,8 +363,19 @@ getNameInfo flags doHost doService addr = withSocketsDo $ serv <- peekIf doService c_serv return (host, serv) _ -> do err <- gai_strerror ret + let message = mconcat + [ "Network.Socket.getNameInfo (called with flags: " + , show flags + , ", hostname lookup: " + , show doHost + , ", service name lookup: " + , show doService + , ", socket address: " + , show addr + , ")" + ] ioError (ioeSetErrorString - (mkIOError NoSuchThing "Network.Socket.getNameInfo" Nothing + (mkIOError NoSuchThing message Nothing Nothing) err) foreign import ccall safe "hsnet_getnameinfo"