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