Windows: slightly improve error reporting

This commit is contained in:
Bert Belder 2011-08-15 04:25:09 +02:00
parent 5020134568
commit c6c3d15d81
2 changed files with 7 additions and 2 deletions

View File

@ -97,15 +97,20 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_ADDRESS_ALREADY_ASSOCIATED: return UV_EADDRINUSE;
case WSAEADDRINUSE: return UV_EADDRINUSE;
case WSAEADDRNOTAVAIL: return UV_EADDRNOTAVAIL;
case WSAEAFNOSUPPORT: return UV_EAFNOSUPPORT;
case WSAEWOULDBLOCK: return UV_EAGAIN;
case WSAEALREADY: return UV_EALREADY;
case ERROR_CONNECTION_REFUSED: return UV_ECONNREFUSED;
case WSAECONNREFUSED: return UV_ECONNREFUSED;
case WSAEFAULT: return UV_EFAULT;
case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH;
case WSAEHOSTUNREACH: return UV_EHOSTUNREACH;
case ERROR_INVALID_DATA: return UV_EINVAL;
case WSAEINVAL: return UV_EINVAL;
case ERROR_TOO_MANY_OPEN_FILES: return UV_EMFILE;
case WSAEMFILE: return UV_EMFILE;
case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH;
case WSAENETUNREACH: return UV_ENETUNREACH;
case ERROR_OUTOFMEMORY: return UV_ENOMEM;
case ERROR_NOT_SUPPORTED: return UV_ENOTSUP;
case ERROR_INSUFFICIENT_BUFFER: return UV_EINVAL;

View File

@ -380,7 +380,7 @@ int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6 addr) {
handle->flags |= UV_HANDLE_IPV6;
return uv__bind(handle, AF_INET6, (struct sockaddr*)&addr, sizeof(struct sockaddr_in6));
} else {
uv_new_sys_error(UV_EAFNOSUPPORT);
uv_new_sys_error(WSAEAFNOSUPPORT);
return -1;
}
}
@ -624,7 +624,7 @@ int uv_tcp_connect6(uv_connect_t* req, uv_tcp_t* handle,
DWORD bytes;
if (!uv_allow_ipv6) {
uv_new_sys_error(UV_EAFNOSUPPORT);
uv_new_sys_error(WSAEAFNOSUPPORT);
return -1;
}