Skip to content

Instantly share code, notes, and snippets.

@tj
Forked from nex3/server.js
Created August 5, 2010 22:17
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 tj/510491 to your computer and use it in GitHub Desktop.
Save tj/510491 to your computer and use it in GitHub Desktop.
var express = require("express");
var app = express.createServer();
app.get("/", function(req, res, next) {
setTimeout(function() {
next(new Error("OH NO"));
}, 10);
});
app.error(function(err, req, res, next) {
console.log("In the error handler");
// you cant pass req/res, only err
next(err);
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment