Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Emit middlewareError when on middleware error. #457

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

philjackson commented Sep 10, 2013

A couple of patches (one updating the README) which allow a user to handle middleware errors in much the same way they might in express. For example, within the middleware calling:

next(new Error("I'm a gonner"));

Now emits middlewareError and can be handled later like this:

 server.proxy.on('middlewareError', function (err, res, req) {
   // handle the error here and call res.end()
 });

This change is backwardly compatible and the old behaviour persists if nothing heard the middlewareError event.

Owner

indexzero commented Dec 27, 2013

I like it.

Owner

indexzero commented Dec 27, 2013

cherry-picked. Thanks.

@indexzero indexzero closed this Dec 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment