-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
doc: add DOMException section to errors API reference #64236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ChloeVPin
wants to merge
3
commits into
nodejs:main
Choose a base branch
from
ChloeVPin:doc/domexception-errors-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+31
−0
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -397,6 +397,36 @@ 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} | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Indicates an error according to the | ||||||||||||||||||||||||||
| [Web IDL DOMException interface][Web IDL DOMException]. These errors are thrown | ||||||||||||||||||||||||||
| by web-platform APIs in Node.js such as | ||||||||||||||||||||||||||
| [`fetch()`][], {AbortController}, {AbortSignal}, and Web Streams. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| For details on the `DOMException` class, see [`Class: DOMException`][]. The | ||||||||||||||||||||||||||
| class is also documented on [MDN][]. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Class: `RangeError` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| * Extends: {errors.Error} | ||||||||||||||||||||||||||
|
|
@@ -4566,6 +4596,7 @@ An error occurred trying to allocate memory. This should never happen. | |||||||||||||||||||||||||
| [ICU]: intl.md#internationalization-support | ||||||||||||||||||||||||||
| [JSON Web Key Elliptic Curve Registry]: https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve | ||||||||||||||||||||||||||
| [JSON Web Key Types Registry]: https://www.iana.org/assignments/jose/jose.xhtml#web-key-types | ||||||||||||||||||||||||||
| [MDN]: https://developer.mozilla.org/en-US/docs/Web/API/DOMException | ||||||||||||||||||||||||||
|
aduh95 marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||
| [Native TypeScript support]: typescript.md#type-stripping | ||||||||||||||||||||||||||
| [Node.js error codes]: #nodejs-error-codes | ||||||||||||||||||||||||||
| [Permission Model]: permissions.md#permission-model | ||||||||||||||||||||||||||
|
|
@@ -4575,14 +4606,18 @@ 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 DOMException]: https://webidl.spec.whatwg.org/#idl-DOMException | ||||||||||||||||||||||||||
| [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: DOMException`]: globals.md#class-domexception | ||||||||||||||||||||||||||
|
aduh95 marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||
| [`Class: assert.AssertionError`]: assert.md#class-assertassertionerror | ||||||||||||||||||||||||||
| [`ERR_INCOMPATIBLE_OPTION_PAIR`]: #err_incompatible_option_pair | ||||||||||||||||||||||||||
| [`ERR_INVALID_ARG_TYPE`]: #err_invalid_arg_type | ||||||||||||||||||||||||||
|
|
@@ -4609,10 +4644,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 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.