-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Description
getNameInfo has the ability to report a name resolution error by means of returning Nothing. When the NI_NAMEREQD flag is not set, resolution will never fail because the function simply returns the IP address we were trying to look up. When NI_NAMEREQD is set, however, the function is supposed to fail when that address can't be resolved. Curiously enough, that failure is communicated through an IOException instead of simply returning Nothing! This is really surprising to me and I find myself writing code like
getNameInfo [NI_NAMEREQD] True False localAddr `catchIO` \_ -> return (Nothing,Nothing)
most of the time.
Is there any particular reason why an IOException is used to communicate a perfectly legitimate result of that function call?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels