if (::getaddrinfo(saddr.c_str(), NULL, &hints, &res) != 0)
throw sys_error();
getaddrinfo doesn't set errno; it returns an error code instead. So this results in throwing a sys_err with a code of zero, which isn't useful.
Worse, these error codes aren't errno values, they're a different numbering system declared in netdb.h, like EAI_NONAME (8), so putting the error code in the sys_error would be a mistake.
Best solution is probably to create a getaddrinfo_error exception class and throw that...
In inet_address.cpp:
getaddrinfo
doesn't seterrno
; it returns an error code instead. So this results in throwing asys_err
with a code of zero, which isn't useful.Worse, these error codes aren't
errno
values, they're a different numbering system declared in netdb.h, likeEAI_NONAME
(8), so putting the error code in thesys_error
would be a mistake.Best solution is probably to create a
getaddrinfo_error
exception class and throw that...