Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,32 @@ error object, such as a {Proxy}.
Indicates the failure of an assertion. For details, see
[`Class: assert.AssertionError`][].

## Class: `DOMException`

<!-- YAML
added: v17.0.0
-->

* 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.

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`][].
Comment on lines +418 to +424

@aduh95 aduh95 Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`][].
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.


## Class: `RangeError`

* Extends: {errors.Error}
Expand Down Expand Up @@ -4575,13 +4601,15 @@ 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
[`--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
[`BoundSocket`]: net.md#class-netboundsocket
[`Class: assert.AssertionError`]: assert.md#class-assertassertionerror
[`ERR_INCOMPATIBLE_OPTION_PAIR`]: #err_incompatible_option_pair
Expand Down Expand Up @@ -4609,10 +4637,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
Expand Down