docs
This commit is contained in:
parent
99895aa215
commit
5cc50ef2c8
1 changed files with 15 additions and 0 deletions
15
docs/api.md
15
docs/api.md
|
@ -513,6 +513,21 @@ switch (this.accepts('json', 'html', 'text')) {
|
||||||
|
|
||||||
Request socket object.
|
Request socket object.
|
||||||
|
|
||||||
|
## Error handling
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```js
|
||||||
|
app.on('error', function(err){
|
||||||
|
log.error('server error', err);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
When an error occurs _and_ it is still possible to respond to the client, aka no data has been written to the socket, Koa will respond
|
||||||
|
appropriately with a 500 "Internal Server Error". In either case
|
||||||
|
an app-level "error" is emitted for logging purposes.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
### HEAD support
|
### HEAD support
|
||||||
|
|
Loading…
Reference in a new issue