-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Unix.getaddrinfo
doesn't report errors
#13075
Comments
noteworthy to link to https://github.com/haesbaert/ocaml-getaddrinfo which as far as I remember does error reporting nicely. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
getaddrinfo
(POSIX, Windows) errors are not set intoerrno
, but returned to the caller. The implementation ofUnix.getaddrinfo
doesn't report errors to the OCaml side and returns an empty list instead.Errors codes returned from
getaddrinfo
are distinct fromerrno
errors and likely shouldn't be mapped (contrary to, for examples, error code of the POSIX threads API). Maybe a distinctUnix.addrinfo_error
exception type should be added?Note that on POSIX platforms, if
EAI_SYSTEM
is returned, thenerrno
should be checked to report system errors (not specific togetaddrinfo
). This would also mean raising aUnix.unix_error
in this case.Should these two points be considered? Is introducing an exception a breaking change, frowned upon? Another option would be to
failwith
a string, like inUnix.map_file
.The remarks also apply to
getnameinfo
and related. Error reporting has been missing since the introduction of IPv6 in OCaml 21 years ago, so that's probably not a hot topic.The text was updated successfully, but these errors were encountered: