Skip to content

Instantly share code, notes, and snippets.

@simenbrekken
Created September 15, 2011 08:32
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 simenbrekken/1218828 to your computer and use it in GitHub Desktop.
Save simenbrekken/1218828 to your computer and use it in GitHub Desktop.
JSON error middleware
app.use(app.router);
app.use(function(err, req, res, next) {
res.json({error: err.message}, 500);
});
app.get(...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment