From 31947449e30a8bc46ebf94d426ad09b9ad718b40 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 7 Mar 2019 09:13:40 -0500 Subject: [PATCH] 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 Reviewed-By: Ruben Bridgewater Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: James M Snell --- doc/api/errors.md | 3 +++ lib/internal/errors.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 55ec282671a153..ebe7de64a2bf9a 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -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 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 operation that requires elevated privileges. diff --git a/lib/internal/errors.js b/lib/internal/errors.js index b3b745252a195d..a76153297ecd69 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -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 // c-ares error code. if (typeof code === 'number') { - // FIXME(bnoordhuis) Remove this backwards compatibility nonsense and pass - // the true error to the user. ENOTFOUND is not even a proper POSIX error! + // ENOTFOUND is not a proper POSIX error, but this error has been in place + // long enough that it's not practical to remove it. if (code === lazyUv().UV_EAI_NODATA || code === lazyUv().UV_EAI_NONAME) { code = 'ENOTFOUND'; // Fabricated error name. } else {