Skip to content

doc: add DOMException section to errors API reference#64236

Open
ChloeVPin wants to merge 3 commits into
nodejs:mainfrom
ChloeVPin:doc/domexception-errors-page
Open

doc: add DOMException section to errors API reference#64236
ChloeVPin wants to merge 3 commits into
nodejs:mainfrom
ChloeVPin:doc/domexception-errors-page

Conversation

@ChloeVPin

Copy link
Copy Markdown

Fixes #40789

Adds a ## Class: DOMException section to doc/api/errors.md, following the
same cross-link pattern used for AssertionError (summary on the Errors page,
details on the globals page).

The section documents:

  • Web IDL and MDN references for DOMException
  • Numeric domException.code values (for example 20 for ABORT_ERR) versus
    string error.code values used by most Node.js errors
  • The distinction between DOMException abort errors from web-platform APIs
    (fetch(), AbortSignal.throwIfAborted(), and similar) and Node.js
    AbortError (code of 'ABORT_ERR') thrown by Node-specific APIs such as
    events.once()
  • That err?.name === 'AbortError' works for identifying abort errors in both
    cases

Verified locally with node tools/lint-md/lint-md.mjs doc/api/errors.md.

Document the DOMException error class on the Errors page, cross-link
to globals.md, and clarify how DOMException abort errors differ from
Node.js AbortError used by Node-specific AbortSignal APIs.

Fixes: nodejs#40789

Signed-off-by: ChloeVPin <227690662+ChloeVPin@users.noreply.github.com>
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. errors Issues and PRs related to JavaScript errors originated in Node.js core. labels Jul 1, 2026
Comment thread doc/api/errors.md Outdated
Signed-off-by: ChloeVPin <227690662+ChloeVPin@users.noreply.github.com>
Comment thread doc/api/errors.md Outdated
Comment thread doc/api/errors.md Outdated
Comment thread doc/api/errors.md Outdated
Signed-off-by: ChloeVPin <227690662+ChloeVPin@users.noreply.github.com>
Comment thread doc/api/errors.md
Comment on lines +418 to +424
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`][].

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. errors Issues and PRs related to JavaScript errors originated in Node.js core.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc: DOMException missing from “Errors” API reference docs page

3 participants