diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2019-04-03 21:40:22 +0300 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2019-04-03 22:44:53 +0300 |
commit | 10eaf6a09feee78275d5c1f84ce46815d8a8772f (patch) | |
tree | 89bb98f39977f6f240660a23927a40634d3ac273 /doc/api/errors.md | |
parent | 883a0d521ff44971806dd6baba8cf74102268a4d (diff) | |
download | android-node-v8-10eaf6a09feee78275d5c1f84ce46815d8a8772f.tar.gz android-node-v8-10eaf6a09feee78275d5c1f84ce46815d8a8772f.tar.bz2 android-node-v8-10eaf6a09feee78275d5c1f84ce46815d8a8772f.zip |
doc: fix section sorting, add link reference
PR-URL: https://github.com/nodejs/node/pull/27075
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc/api/errors.md')
-rw-r--r-- | doc/api/errors.md | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/doc/api/errors.md b/doc/api/errors.md index a1fb20e58f..547d1ff8d2 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -407,34 +407,6 @@ try { `SyntaxError` instances are unrecoverable in the context that created them – they may only be caught by other contexts. -## Class: TypeError - -A subclass of `Error` that indicates that a provided argument is not an -allowable type. For example, passing a function to a parameter which expects a -string would be considered a `TypeError`. - -```js -require('url').parse(() => { }); -// Throws TypeError, since it expected a string. -``` - -Node.js will generate and throw `TypeError` instances *immediately* as a form -of argument validation. - -## Exceptions vs. Errors - -<!--type=misc--> - -A JavaScript exception is a value that is thrown as a result of an invalid -operation or as the target of a `throw` statement. While it is not required -that these values are instances of `Error` or classes which inherit from -`Error`, all exceptions thrown by Node.js or the JavaScript runtime *will* be -instances of `Error`. - -Some exceptions are *unrecoverable* at the JavaScript layer. Such exceptions -will *always* cause the Node.js process to crash. Examples include `assert()` -checks or `abort()` calls in the C++ layer. - ## Class: SystemError 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][]. encountered by [`http`][] or [`net`][] — often a sign that a `socket.end()` was not properly called. +## Class: TypeError + +A subclass of `Error` that indicates that a provided argument is not an +allowable type. For example, passing a function to a parameter which expects a +string would be considered a `TypeError`. + +```js +require('url').parse(() => { }); +// Throws TypeError, since it expected a string. +``` + +Node.js will generate and throw `TypeError` instances *immediately* as a form +of argument validation. + +## Exceptions vs. Errors + +<!--type=misc--> + +A JavaScript exception is a value that is thrown as a result of an invalid +operation or as the target of a `throw` statement. While it is not required +that these values are instances of `Error` or classes which inherit from +`Error`, all exceptions thrown by Node.js or the JavaScript runtime *will* be +instances of `Error`. + +Some exceptions are *unrecoverable* at the JavaScript layer. Such exceptions +will *always* cause the Node.js process to crash. Examples include `assert()` +checks or `abort()` calls in the C++ layer. + ## OpenSSL Errors Errors originating in `crypto` or `tls` are of class `Error`, and in addition to |