expressjs / expressjs/express

path specific error handler not called

Open
#2,526 3 comments 0 reactions 0 assignees View on GitHub
4.x discuss module:router
Dominant language
JavaScript
Stars
69.5k
Forks
25k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

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?

``` javascript
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"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.