Skip to content

Commit 10eaf6a

Browse files
committed
doc: fix section sorting, add link reference
PR-URL: #27075 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 883a0d5 commit 10eaf6a

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

doc/api/errors.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -407,34 +407,6 @@ try {
407407
`SyntaxError` instances are unrecoverable in the context that created them –
408408
they may only be caught by other contexts.
409409

410-
## Class: TypeError
411-
412-
A subclass of `Error` that indicates that a provided argument is not an
413-
allowable type. For example, passing a function to a parameter which expects a
414-
string would be considered a `TypeError`.
415-
416-
```js
417-
require('url').parse(() => { });
418-
// Throws TypeError, since it expected a string.
419-
```
420-
421-
Node.js will generate and throw `TypeError` instances *immediately* as a form
422-
of argument validation.
423-
424-
## Exceptions vs. Errors
425-
426-
<!--type=misc-->
427-
428-
A JavaScript exception is a value that is thrown as a result of an invalid
429-
operation or as the target of a `throw` statement. While it is not required
430-
that these values are instances of `Error` or classes which inherit from
431-
`Error`, all exceptions thrown by Node.js or the JavaScript runtime *will* be
432-
instances of `Error`.
433-
434-
Some exceptions are *unrecoverable* at the JavaScript layer. Such exceptions
435-
will *always* cause the Node.js process to crash. Examples include `assert()`
436-
checks or `abort()` calls in the C++ layer.
437-
438410
## Class: SystemError
439411

440412
Node.js generates system errors when exceptions occur within its runtime
@@ -575,6 +547,34 @@ program. For a comprehensive list, see the [`errno`(3) man page][].
575547
encountered by [`http`][] or [`net`][] — often a sign that a `socket.end()`
576548
was not properly called.
577549

550+
## Class: TypeError
551+
552+
A subclass of `Error` that indicates that a provided argument is not an
553+
allowable type. For example, passing a function to a parameter which expects a
554+
string would be considered a `TypeError`.
555+
556+
```js
557+
require('url').parse(() => { });
558+
// Throws TypeError, since it expected a string.
559+
```
560+
561+
Node.js will generate and throw `TypeError` instances *immediately* as a form
562+
of argument validation.
563+
564+
## Exceptions vs. Errors
565+
566+
<!--type=misc-->
567+
568+
A JavaScript exception is a value that is thrown as a result of an invalid
569+
operation or as the target of a `throw` statement. While it is not required
570+
that these values are instances of `Error` or classes which inherit from
571+
`Error`, all exceptions thrown by Node.js or the JavaScript runtime *will* be
572+
instances of `Error`.
573+
574+
Some exceptions are *unrecoverable* at the JavaScript layer. Such exceptions
575+
will *always* cause the Node.js process to crash. Examples include `assert()`
576+
checks or `abort()` calls in the C++ layer.
577+
578578
## OpenSSL Errors
579579

580580
Errors originating in `crypto` or `tls` are of class `Error`, and in addition to

doc/api/os.md

+1
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,7 @@ The following process scheduling constants are exported by
13151315
</tr>
13161316
</table>
13171317

1318+
[`SystemError`]: errors.html#errors_class_systemerror
13181319
[`process.arch`]: process.html#process_process_arch
13191320
[`process.platform`]: process.html#process_process_platform
13201321
[Android building]: https://github.com/nodejs/node/blob/master/BUILDING.md#androidandroid-based-devices-eg-firefox-os

0 commit comments

Comments
 (0)