-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The getNameInfo API is a little strange #416
Comments
To make matters even more complicated, there are use cases for I suppose you'd really want a family of functions that express different operations with an API that's appropriate. |
@eborden We should also consider this when we introduced a new error mechanism. |
@peti The current maintainers of |
#151 is the primary issue for rethinking error handling. Mentioning it in this issue will make it visible there and more likely to be considered when addressing error handling in general. @peti, I agree it is surprising. I don't see anything in Is there a reason to expand failure modes beyond |
Yes, absolutely. The
Some of those (like
Personally, I prefer |
getNameInfo
has the ability to report a name resolution error by means of returningNothing
. When theNI_NAMEREQD
flag is not set, resolution will never fail because the function simply returns the IP address we were trying to look up. WhenNI_NAMEREQD
is set, however, the function is supposed to fail when that address can't be resolved. Curiously enough, that failure is communicated through anIOException
instead of simply returningNothing
! This is really surprising to me and I find myself writing code likemost of the time.
Is there any particular reason why an
IOException
is used to communicate a perfectly legitimate result of that function call?The text was updated successfully, but these errors were encountered: