Skip to content
Myr

More app.error() docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent c145a8e · Browse files · 1 file+5 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−0 removed

  • other:+5 added−0 removed

1 file+5 added−0 removed

modified:docs/guide.md+5 added
219 unmodified lines
220We can call _app.error()_ several times as shown below.221Here we check for an instanceof _NotFound_ and show the222404 page, or we pass on to the next error handler.223224Note that these handlers can be defined anywhere, as they225will be placed below the route handlers on _listen()_. This 226allows for definition within _configure()_ blocks so we can227handle exceptions in different ways based on the environment.228229 app.error(function(err, req, res, next){230 if (err instanceof NotFound) {231 res.render('404.jade');232 } else {
457 unmodified lines