Skip to content

Commit 7122a3f

Browse files
cjihrigBridgeAR
authored andcommitted
doc: document fake ENOTFOUND as a system error
PR-URL: #26495 Fixes: #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>
1 parent 3775526 commit 7122a3f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

doc/api/errors.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,9 @@ program. For a comprehensive list, see the [`errno`(3) man page][].
573573
- `ENOTEMPTY` (Directory not empty): A directory with entries was the target
574574
of an operation that requires an empty directory — usually [`fs.unlink`][].
575575

576+
- `ENOTFOUND` (DNS lookup failed): Indicates a DNS failure of either
577+
`EAI_NODATA` or `EAI_NONAME`. This is not a standard POSIX error.
578+
576579
- `EPERM` (Operation not permitted): An attempt was made to perform an
577580
operation that requires elevated privileges.
578581

lib/internal/errors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ function dnsException(code, syscall, hostname) {
432432
// If `code` is of type number, it is a libuv error number, else it is a
433433
// c-ares error code.
434434
if (typeof code === 'number') {
435-
// FIXME(bnoordhuis) Remove this backwards compatibility nonsense and pass
436-
// the true error to the user. ENOTFOUND is not even a proper POSIX error!
435+
// ENOTFOUND is not a proper POSIX error, but this error has been in place
436+
// long enough that it's not practical to remove it.
437437
if (code === lazyUv().UV_EAI_NODATA || code === lazyUv().UV_EAI_NONAME) {
438438
code = 'ENOTFOUND'; // Fabricated error name.
439439
} else {

0 commit comments

Comments
 (0)