Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Error handling is broken in the controller #71

Closed
flanamacca opened this Issue · 3 comments

3 participants

Roland Flanagan William Khoe Jared Hanson
Roland Flanagan

Hey guys,

Taking a look at the controller error handler

Note that err and e when logged are both null. This stops any error handling middleware useless since they bypass null errors.

Controller.prototype.error = function(err) {
var self = this;
// Give controller-level after filters an opportunity to handle the error. If
// not handled, pass control out to Express for application-level handling.
this._devoke(err, function(e) {
console.log('Calling middleweare', err, e);
return self.__next(e);
});
}

FIX::: Controller.prototype._invoke = function(action) {
...
...
Line 451
try {
selfaction;
return;
} catch (e) {
return self.error(err); <-------- Should be e
}

William Khoe

+1 I ran into this issue too.

Odd though, this worked using previous Express version (not sure which version, but definitely 3.0.5 below). After I upgrade to latest, I find that the error handling flow leaks outside the controller to the next middleware.

William Khoe pixelfreak referenced this issue from a commit in pixelfreak/locomotive
William Khoe pixelfreak Fixed Issue #71
Fixed broken error handling
8930938
Jared Hanson
Owner

Merged #73. @pixelfreak thanks for the patch!

William Khoe

Thanks for merging! :+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.