0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/doc/api
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
..
addons.md doc: hello addon example should return "world" 2019-03-05 23:54:31 +01:00
assert.md doc: update assert's validation functions 2019-06-12 20:02:53 -07:00
async_hooks.md src: do not reuse async resource in http parsers 2019-04-22 11:51:46 -07:00
buffer.md doc: add Buffer#subarray() and add note about Uint8Array#slice() 2019-06-12 19:40:37 -07:00
child_process.md doc: correct parameter type on 'subprocess.kill([signal])' 2019-05-20 23:00:31 +08:00
cli.md doc,test: test documentation consistency for NODE_OPTIONS 2019-06-14 20:47:31 -07:00
cluster.md benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
console.md benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
crypto.md doc: clarify weak keys text 2019-06-08 18:16:08 -07:00
debugger.md
deprecations.md doc: edit reason-for-deprecation text 2019-06-08 18:58:23 -07:00
dgram.md 2019-04-23, Version 12.0.0 (Current) 2019-04-23 16:46:54 +01:00
dns.md doc: document behavior of family:0 in dns.lookup() 2019-06-14 22:00:38 +08:00
documentation.md doc: simplify system call material in doc overview 2019-06-02 00:10:01 +02:00
domain.md benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
errors.md lib: correct error.errno to always be numeric 2019-06-17 10:18:09 +08:00
esm.md doc: pass path in URL constructor 2019-06-14 17:19:21 +08:00
events.md 2019-03-28, Version 11.13.0 (Current) 2019-03-28 20:23:29 +01:00
fs.md fs: add *timeNs properties to BigInt Stats objects 2019-06-14 03:24:41 +08:00
globals.md lib: move queueMicrotask to stable 2019-03-08 08:19:38 -06:00
http2.md doc: document Http2Stream#id property 2019-06-10 17:02:41 -07:00
http.md http, http2: remove default server timeout 2019-05-09 08:54:04 -07:00
https.md http: servername === false should disable SNI 2019-04-30 06:43:22 -07:00
index.md doc: add node-report documentation 2019-01-18 10:35:55 +05:30
inspector.md doc: add inspector API example for heapdump 2019-03-11 06:19:11 +01:00
intl.md
modules.md doc: clarify wording in modules.md 2019-06-02 11:57:01 +02:00
n-api.md doc,n-api: fix typo 2019-06-13 16:40:22 -04:00
net.md benchmark,doc,lib,test: capitalize comments 2019-03-10 00:44:40 +01:00
os.md doc: fix section sorting, add link reference 2019-04-03 22:44:53 +03:00
path.md doc: fix extname with the correct description 2019-04-20 17:01:09 +03:00
perf_hooks.md benchmark,doc,lib,test: capitalize comments 2019-03-10 00:44:40 +01:00
policy.md doc: fix metadata for v11.8.0 doc changes 2019-01-25 19:09:26 -08:00
process.md 2019-04-23, Version 12.0.0 (Current) 2019-04-23 16:46:54 +01:00
punycode.md
querystring.md benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
readline.md 2019-04-11, Version 11.14.0 (Current) 2019-04-11 17:56:55 +01:00
repl.md 2019-05-21, Version 12.3.0 (Current) 2019-05-21 21:23:52 +02:00
report.md report: add cpu info to report output 2019-06-15 20:53:07 -07:00
stream.md stream: convert string to Buffer when calling unshift(<string>) 2019-06-02 16:56:13 +02:00
string_decoder.md
synopsis.md doc: improve synopsis.md 2019-06-09 09:20:25 -07:00
timers.md benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
tls.md doc: remove "strongly recommended" hedging from tls.md 2019-06-05 23:11:28 +08:00
tracing.md doc: document trace-events category for dns requests 2019-06-12 19:42:54 -07:00
tty.md doc: specify return type for tty.isatty() 2019-04-09 23:06:46 +03:00
url.md doc: clarify special schemes 2019-06-08 18:51:41 -07:00
util.md util: include reference anchor for circular structures 2019-05-20 14:20:59 +02:00
v8.md src: export number_of_native_contexts and number_of_detached_contexts 2019-05-30 15:25:55 +02:00
vm.md doc: fix section order in vm.md 2019-01-14 09:36:41 +01:00
worker_threads.md doc: add note about AsyncResource for Worker pooling 2019-06-10 15:20:54 +02:00
zlib.md benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00