Skip to content

Commit a5ef2e8

Browse files
legendecasRafaelGSS
authored andcommitted
doc: list DOMException as a potential error raised by Node.js
PR-URL: #57783 Refs: #57735 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 17965eb commit a5ef2e8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

doc/api/errors.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,28 @@
44

55
<!--type=misc-->
66

7-
Applications running in Node.js will generally experience four categories of
8-
errors:
7+
Applications running in Node.js will generally experience the following
8+
categories of errors:
99

1010
* Standard JavaScript errors such as {EvalError}, {SyntaxError}, {RangeError},
1111
{ReferenceError}, {TypeError}, and {URIError}.
12+
* Standard `DOMException`s.
1213
* System errors triggered by underlying operating system constraints such
1314
as attempting to open a file that does not exist or attempting to send data
1415
over a closed socket.
15-
* User-specified errors triggered by application code.
1616
* `AssertionError`s are a special class of error that can be triggered when
1717
Node.js detects an exceptional logic violation that should never occur. These
1818
are raised typically by the `node:assert` module.
19+
* User-specified errors triggered by application code.
1920

2021
All JavaScript and system errors raised by Node.js inherit from, or are
2122
instances of, the standard JavaScript {Error} class and are guaranteed
2223
to provide _at least_ the properties available on that class.
2324

25+
The [`error.message`][] property of errors raised by Node.js may be changed in
26+
any versions. Use [`error.code`][] to identify an error instead. For a
27+
`DOMException`, use [`domException.name`][] to identify its type.
28+
2429
## Error propagation and interception
2530

2631
<!--type=misc-->
@@ -4303,7 +4308,10 @@ An error occurred trying to allocate memory. This should never happen.
43034308
[`dgram.createSocket()`]: dgram.md#dgramcreatesocketoptions-callback
43044309
[`dgram.disconnect()`]: dgram.md#socketdisconnect
43054310
[`dgram.remoteAddress()`]: dgram.md#socketremoteaddress
4311+
[`domException.name`]: https://developer.mozilla.org/en-US/docs/Web/API/DOMException/name
43064312
[`errno`(3) man page]: https://man7.org/linux/man-pages/man3/errno.3.html
4313+
[`error.code`]: #errorcode
4314+
[`error.message`]: #errormessage
43074315
[`fs.Dir`]: fs.md#class-fsdir
43084316
[`fs.cp()`]: fs.md#fscpsrc-dest-options-callback
43094317
[`fs.readFileSync`]: fs.md#fsreadfilesyncpath-options

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy