From 22cf50354b785bca7ea2e1bf0c906fdd8b4be465 Mon Sep 17 00:00:00 2001 From: Avocado Date: Tue, 11 Aug 2026 14:05:55 +0900 Subject: [PATCH 1/3] doc: add DOMException section to errors API reference Document DOMException on the Errors page (with a Globals cross-link) and clarify AbortError vs DOMException for AbortSignal users. Builds on #64236 review feedback. Fixes #40789. Signed-off-by: Avocado --- doc/api/errors.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/doc/api/errors.md b/doc/api/errors.md index a248984d984b..908d9d0256d2 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -397,6 +397,32 @@ error object, such as a {Proxy}. Indicates the failure of an assertion. For details, see [`Class: assert.AssertionError`][]. +## Class: `DOMException` + + + +* Extends: {errors.Error} + +The Web IDL {DOMException} class. These errors are thrown by web-platform APIs +in Node.js such as [`fetch()`][], {AbortController}, {AbortSignal}, and Web +Streams. For details, see also [`Class: DOMException`][] on the Globals page. + +The [`domException.name`][] property identifies the type of the exception (for +example, `'AbortError'`). Unlike most errors in Node.js, the +[`domException.code`][] property is a number that corresponds to a +[legacy error code name][Web IDL error names] (for example, `20` for +`ABORT_ERR`). + +Node.js-specific APIs that support {AbortSignal} (such as +[`events.once()`][]) throw a Node.js `AbortError` (a native {errors.Error} with +`name` of `'AbortError'` and `code` of [`'ABORT_ERR'`][]) rather than a +{DOMException}. To identify abort errors in either case, checking +`err?.name === 'AbortError'` is sufficient. + +See also [`ABORT_ERR`][]. + ## Class: `RangeError` * Extends: {errors.Error} @@ -4640,6 +4666,7 @@ An error occurred trying to allocate memory. This should never happen. [V8's stack trace API]: https://v8.dev/docs/stack-trace-api [WHATWG Supported Encodings]: util.md#whatwg-supported-encodings [WHATWG URL API]: url.md#the-whatwg-url-api +[Web IDL error names]: https://webidl.spec.whatwg.org/#dfn-error-names-table [`"exports"`]: packages.md#exports [`"imports"`]: packages.md#imports [`'uncaughtException'`]: process.md#event-uncaughtexception @@ -4648,6 +4675,9 @@ An error occurred trying to allocate memory. This should never happen. [`--no-addons`]: cli.md#--no-addons [`--unhandled-rejections`]: cli.md#--unhandled-rejectionsmode [`BoundSocket`]: net.md#class-netboundsocket +[`'ABORT_ERR'`]: #abort_err +[`ABORT_ERR`]: #abort_err +[`Class: DOMException`]: globals.md#class-domexception [`Class: assert.AssertionError`]: assert.md#class-assertassertionerror [`ERR_INCOMPATIBLE_OPTION_PAIR`]: #err_incompatible_option_pair [`ERR_INVALID_ARG_TYPE`]: #err_invalid_arg_type @@ -4676,10 +4706,13 @@ An error occurred trying to allocate memory. This should never happen. [`dgram.createSocket()`]: dgram.md#dgramcreatesocketoptions-callback [`dgram.disconnect()`]: dgram.md#socketdisconnect [`dgram.remoteAddress()`]: dgram.md#socketremoteaddress +[`domException.code`]: https://developer.mozilla.org/en-US/docs/Web/API/DOMException/code [`domException.name`]: https://developer.mozilla.org/en-US/docs/Web/API/DOMException/name [`errno`(3) man page]: https://man7.org/linux/man-pages/man3/errno.3.html [`error.code`]: #errorcode [`error.message`]: #errormessage +[`events.once()`]: events.md#eventsonceemitter-name-options +[`fetch()`]: globals.md#fetch [`fs.Dir`]: fs.md#class-fsdir [`fs.cp()`]: fs.md#fscpsrc-dest-options-callback [`fs.readFileSync`]: fs.md#fsreadfilesyncpath-options From a46e0928679ad7d194c4c7e2214726226509af9d Mon Sep 17 00:00:00 2001 From: Avocado Date: Tue, 11 Aug 2026 14:06:14 +0900 Subject: [PATCH 2/3] doc: sort DOMException reference link definitions Signed-off-by: Avocado --- doc/api/errors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 908d9d0256d2..b001877042f3 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -4674,9 +4674,9 @@ An error occurred trying to allocate memory. This should never happen. [`--force-fips`]: cli.md#--force-fips [`--no-addons`]: cli.md#--no-addons [`--unhandled-rejections`]: cli.md#--unhandled-rejectionsmode -[`BoundSocket`]: net.md#class-netboundsocket [`'ABORT_ERR'`]: #abort_err [`ABORT_ERR`]: #abort_err +[`BoundSocket`]: net.md#class-netboundsocket [`Class: DOMException`]: globals.md#class-domexception [`Class: assert.AssertionError`]: assert.md#class-assertassertionerror [`ERR_INCOMPATIBLE_OPTION_PAIR`]: #err_incompatible_option_pair From 30cf35016b0d2efc7cef64e986bb42b864336123 Mon Sep 17 00:00:00 2001 From: Avocado Date: Tue, 11 Aug 2026 14:34:16 +0900 Subject: [PATCH 3/3] doc: fix DOMException reference link sort order Fix ABORT_ERR reference order for nodejs-links. Signed-off-by: Avocado Co-authored-by: Cursor --- doc/api/errors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index b001877042f3..b6a1947cfe1c 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -4669,12 +4669,12 @@ An error occurred trying to allocate memory. This should never happen. [Web IDL error names]: https://webidl.spec.whatwg.org/#dfn-error-names-table [`"exports"`]: packages.md#exports [`"imports"`]: packages.md#imports +[`'ABORT_ERR'`]: #abort_err [`'uncaughtException'`]: process.md#event-uncaughtexception [`--disable-proto=throw`]: cli.md#--disable-protomode [`--force-fips`]: cli.md#--force-fips [`--no-addons`]: cli.md#--no-addons [`--unhandled-rejections`]: cli.md#--unhandled-rejectionsmode -[`'ABORT_ERR'`]: #abort_err [`ABORT_ERR`]: #abort_err [`BoundSocket`]: net.md#class-netboundsocket [`Class: DOMException`]: globals.md#class-domexception