Skip to content
Myr

More 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 9fbb9fa · Browse files · 3 files+7 added−3 removed
This commit

State

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

Diff stats

3 files+7 added−3 removed

  • other:+7 added−3 removed

3 files+7 added−3 removed

modified:docs/guide.1+1 added-1 removed
689 unmodified lines
690.691.IP "" 0692.693.SS "app\.error(function)"694Adds an error handler \fIfunction\fR which will receive the exception as the first parameter:694Adds an error handler \fIfunction\fR which will receive the exception as the first parameter as shown below\. Note that we may set several error handlers by making several calls to this method, however the handler should call \fInext(err)\fR if it does not wish to deal with the exception:695.696.IP "" 4697.698.nf
9 unmodified lines
modified:docs/guide.html+3 added-1 removed
668 unmodified lines
669</code></pre>670671<h3 id="app-error-function-">app.error(function)</h3>672673<p>Adds an error handler <em>function</em> which will receive the exception as the first parameter:</p>673<p>Adds an error handler <em>function</em> which will receive the exception as the first parameter as shown below.674Note that we may set several error handlers by making several calls to this method, however the handler675should call <em>next(err)</em> if it does not wish to deal with the exception:</p>676677<pre><code>app.error(function(err, req, res, next){678 res.send(err.message, 500);679});
7 unmodified lines
modified:docs/guide.md+3 added-1 removed
420 unmodified lines
421 });422423### app.error(function)424425Adds an error handler _function_ which will receive the exception as the first parameter:425Adds an error handler _function_ which will receive the exception as the first parameter as shown below.426Note that we may set several error handlers by making several calls to this method, however the handler427should call _next(err)_ if it does not wish to deal with the exception:428429 app.error(function(err, req, res, next){430 res.send(err.message, 500);431 });