Skip to content

Instantly share code, notes, and snippets.

@ahri
Created July 2, 2014 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahri/0263b20f9234b908fe22 to your computer and use it in GitHub Desktop.
Save ahri/0263b20f9234b908fe22 to your computer and use it in GitHub Desktop.
Why doesn't the middleware error handler get called?
var app = require('express')();
app.use(function (err, req, res, next) {
console.log("using my error middleware");
return next(err);
});
app.get('/', function (req, res, next) {
next(new Error("test"));
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment