#2526·express

path specific error handler not called

Author: theriguCreated Feb 2, 2015Updated Jul 25, 2026
Labelsdiscuss4.xmodule:router

The following test passes on 3.x but fails to master. I can't find anything in the migration guide mentioning something like this - is it an intended change I'll need to work around or a regression?

var express = require('../')
  , request = require('supertest');

describe('app', function(){
  describe('.VERB()', function(){
    it('should call an error handling routing callback when path matches', function(done){
      var app = express();

      app.all('*', function (req, res, next) {
        next(new Error('fabricated error'));
      });

      app.get('/', function(err, req, res, next){
        next();
      }, function(req, res){
        res.send(204);
      });

      request(app)
      .get('/')
      .expect(204, done);
    })
  })
})

master gives this error:

  1) app .VERB() should call an error handling routing callback when path matches:
     Error: expected 204 "No Content", got 500 "Internal Server Error"