Ticket #32 (new defect)

Opened 4 years ago

Last modified 4 years ago

Misleading error message when missing withSocketsDo

Reported by: Olathe Owned by:
Priority: major Milestone:
Component: network Version:
Keywords: Cc: Olathe

Description

You must wrap sockets code with Network.Socket.withSocketsDo on Windows, or it will give misleading error messages :

Prelude Network.Socket> getAddrInfo Nothing (Just "google.com") Nothing
*** Exception: getAddrInfo: does not exist (error 10093)
Prelude Network.Socket> withSocketsDo $ getAddrInfo Nothing (Just "google.com") Nothing
[AddrInfo {addrFlags = [], addrFamily = AF_INET, addrSocketType = NoSocketType, ...

I've never used Network directly, so when I got this error using http-enumerator, I reasoned like this: getAddrInfo looks like it resolves hostnames. It says "does not exist", so that means it thinks the hostname doesn't exist, though nslookup finds it just fine. So, I need to spend the next hour trying to get Network working on Windows.

It would be much more clear Winsock error 10093 had an error message like the following:

*** Exception: (functionName): not wrapped with Network.Socket.withSocketsDo

Change History

Changed 4 years ago by Olathe

  • cc Olathe added
Note: See TracTickets for help on using tickets.