Skip to content

Commit

Permalink
doc: address nits
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Dec 30, 2015
1 parent c4299b7 commit ab658f4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions doc/api/errors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
Applications running in Node.js will generally experience four categories of
errors:

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

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

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

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

0 comments on commit ab658f4

Please sign in to comment.