doc: document fake ENOTFOUND as a system error

PR-URL: https://github.com/nodejs/node/pull/26495
Fixes: https://github.com/nodejs/node/issues/26484
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
cjihrig 2019-03-07 09:13:40 -05:00
parent fb54968ce3
commit 31947449e3
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5
2 changed files with 5 additions and 2 deletions

View File

@ -573,6 +573,9 @@ program. For a comprehensive list, see the [`errno`(3) man page][].
- `ENOTEMPTY` (Directory not empty): A directory with entries was the target - `ENOTEMPTY` (Directory not empty): A directory with entries was the target
of an operation that requires an empty directory — usually [`fs.unlink`][]. of an operation that requires an empty directory — usually [`fs.unlink`][].
- `ENOTFOUND` (DNS lookup failed): Indicates a DNS failure of either
`EAI_NODATA` or `EAI_NONAME`. This is not a standard POSIX error.
- `EPERM` (Operation not permitted): An attempt was made to perform an - `EPERM` (Operation not permitted): An attempt was made to perform an
operation that requires elevated privileges. operation that requires elevated privileges.

View File

@ -432,8 +432,8 @@ function dnsException(code, syscall, hostname) {
// If `code` is of type number, it is a libuv error number, else it is a // If `code` is of type number, it is a libuv error number, else it is a
// c-ares error code. // c-ares error code.
if (typeof code === 'number') { if (typeof code === 'number') {
// FIXME(bnoordhuis) Remove this backwards compatibility nonsense and pass // ENOTFOUND is not a proper POSIX error, but this error has been in place
// the true error to the user. ENOTFOUND is not even a proper POSIX error! // long enough that it's not practical to remove it.
if (code === lazyUv().UV_EAI_NODATA || code === lazyUv().UV_EAI_NONAME) { if (code === lazyUv().UV_EAI_NODATA || code === lazyUv().UV_EAI_NONAME) {
code = 'ENOTFOUND'; // Fabricated error name. code = 'ENOTFOUND'; // Fabricated error name.
} else { } else {