add docs for error ctx

This commit is contained in:
TJ Holowaychuk 2013-08-31 09:18:43 -07:00
parent b3761b5da0
commit a1edb2fe7c
2 changed files with 9 additions and 0 deletions

View File

@ -538,6 +538,14 @@ throw err;
By default outputs all errors to stderr unless __NODE_ENV__ is "test". To perform custom error-handling logic such as centralized logging you By default outputs all errors to stderr unless __NODE_ENV__ is "test". To perform custom error-handling logic such as centralized logging you
can add an "error" event listener: can add an "error" event listener:
```js
app.on('error', function(err){
log.error('server error', err);
});
```
If an error in the req/res cycle and it is _not_ possible to respond to the client, the `Context` instance is also passed:
```js ```js
app.on('error', function(err){ app.on('error', function(err){
log.error('server error', err); log.error('server error', err);

View File

@ -1,3 +1,4 @@
/** /**
* Module dependencies. * Module dependencies.
*/ */