Skip to content

Commit

Permalink
Fix: emit restifyError event even for router errors (#1420)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonutEspresso committed Aug 16, 2017
1 parent a2d34aa commit f9d02d5
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 173 deletions.
15 changes: 0 additions & 15 deletions docs/api/server.md
Expand Up @@ -266,21 +266,6 @@ server.on('restifyError', function(req, res, err, callback) {
});
```

### FormatterError

This event is fired when an async formatter returns an error as a result of
calling `res.send()`. Unlike other error events, if you listen this event, it
is expected that you flush a response. Once a formatter has returned an error,
restify cannot make any assumptions about how to format the content. It is up
to you to figure out how to best do that.

```js
server.on('FormatterError', function(req, res, route, err) {
// err is a formatter error - can't sa
res.end('unsafe to call res.send, in case formatter blows up again!');
});
```


## after

Expand Down
2 changes: 0 additions & 2 deletions lib/response.js
Expand Up @@ -16,8 +16,6 @@ var utils = require('./utils');
///--- Globals

var InternalServerError = errors.InternalServerError;
// make custom error constructors
errors.makeConstructor('FormatterError');

var Response = http.ServerResponse;

Expand Down

0 comments on commit f9d02d5

Please sign in to comment.