I am having trouble with express Error handling. Here is my configuration for the server.
server.use(express.static(__dirname + '/public'));
server.use(server.router);
server.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
server.use(express.bodyParser());
Then I try adding this line of code
server.error(function(err, req, res, next){
if (err instanceof NotFound) {
res.render('404.jade');
} else {
next(err);
}
});
Then in my console, I get this message,
Object function app(req, res){ app.handle(req, res); } has no method 'error'
what am I doing wrong? I cant get error handling to work.