Skip to content

Commit ab658f4

Browse files
committed
doc: address nits
1 parent c4299b7 commit ab658f4

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

doc/api/errors.markdown

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
Applications running in Node.js will generally experience four categories of
66
errors:
77

8-
- JavaScript errors caused by improper JavaScript language syntax
9-
([`SyntaxError`][]), use of undefined variables ([`ReferenceError`][]),
10-
passing arguments of the wrong type ([`TypeError`][]), and so on;
8+
- Standard JavaScript errors such as:
9+
- [`EvalError`][]: thrown when a call to `eval()` fails.
10+
- [`SyntaxError`][]: thrown in response to improper JavaScript language
11+
syntax.
12+
- [`RangeError`][]: thrown when a value is not within an expected range
13+
- [`ReferenceError`][]: thrown when using undefined variables
14+
- [`TypeError`][]: thrown when passing arguments of the wrong type
15+
- [`URIError`][]: thrown when a global URI handling function is misused.
1116
- System errors triggered by underlying operating system constraints such
1217
as attempting to open a file that does not exist, attempting to send data
1318
over a closed socket, etc;
@@ -87,7 +92,9 @@ Errors that occur within _Asynchronous APIs_ may be reported in multiple ways:
8792

8893
- A handful of typically asynchronous methods in the Node.js API may still
8994
use the `throw` mechanism to raise exceptions that must be handled using
90-
`try / catch`.
95+
`try / catch`. There is no comprehensive list of such methods; please
96+
refer to the documentation of each method to determine the appropriate
97+
error handling mechanism required.
9198

9299
The use of the `'error'` event mechanism is most common for [stream-based][]
93100
and [event emitter-based][] APIs, which themselves represent a series of
@@ -155,7 +162,7 @@ use `throw` inside a Node.js style callback:
155162
});
156163
} catch(err) {
157164
// This will not catch the throw!
158-
console.log(err); // Error: ENOENT
165+
console.log(err);
159166
}
160167

161168
This will not work because the callback function passed to `fs.readFile()` is

0 commit comments

Comments
 (0)