0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-25 08:19:38 +01:00
nodejs/test/internet
Joyee Cheung 1432065e9d
lib: correct error.errno to always be numeric
Historically `error.errno` of system errors thrown by Node.js
can sometimes be the same as `err.code`, which are string
representations of the error numbers. This is useless and incorrect,
and results in an information loss for users since then they
will have to resort to something like
`process.binding('uv'[`UV_${errno}`])` to get to the numeric
error codes.

This patch corrects this behavior by always setting `error.errno`
to be negative numbers. For fabricated errors like `ENOTFOUND`,
`error.errno` is now undefined since there is no numeric equivalent
for them anyway. For c-ares errors, `error.errno` is now undefined
because the numeric representations (negated) can be in conflict
with libuv error codes - this is fine since numeric codes was
not available for c-ares errors anyway.

Users can use the public API `util.getSystemErrorName(errno)`
to retrieve string codes for these numbers.

PR-URL: https://github.com/nodejs/node/pull/28140
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-06-17 10:18:09 +08:00
..
test-dgram-broadcast-multi-process.js
test-dgram-connect.js
test-dgram-membership.js
test-dgram-multicast-multi-process.js
test-dgram-multicast-set-interface-lo.js
test-dgram-send-cb-quelches-error.js
test-dns-any.js
test-dns-cares-domains.js
test-dns-idna2008.js
test-dns-ipv4.js
test-dns-ipv6.js
test-dns-lookup.js
test-dns-promises-resolve.js
test-dns-regress-6244.js
test-dns-setserver-in-callback-of-resolve4.js
test-dns-txt-sigsegv.js
test-dns.js lib: correct error.errno to always be numeric 2019-06-17 10:18:09 +08:00
test-doctool-versions.js
test-http-dns-fail.js
test-http-https-default-ports.js
test-inspector-help-page.js
test-net-connect-timeout.js
test-net-connect-unref.js
test-tls-add-ca-cert.js
test-tls-connnect-melissadata.js
test-tls-reuse-host-from-socket.js
test-trace-events-dns.js
test-uv-threadpool-schedule.js
testcfg.py