Skip to content
Myr

Altered app.error() tests to reflect issue #387

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 7dff9dd · Browse files · 1 file+11 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−11 removed

  • tests:+11 added−11 removed

1 file+11 added−11 removed

modified:test/express.test.js+11 added-11 removed
75 unmodified lines
7677 // Custom handler78 var app = express.createServer();79 80 app.error(function(err, req, res){81 res.send('Shit: ' + err.message, 500);82 });8384 app.get('/', function(req, res, next){85 next(new Error('broken'));86 });87 84 app.error(function(err, req, res){85 res.send('Shit: ' + err.message, 500);86 });87 88 assert.response(app,89 { url: '/' },90 { body: 'Shit: broken', status: 500 });91 92 // Multiple error()s93 var app = express.createServer();94 95 app.get('/', function(req, res, next){96 throw new Error('broken');97 });98 app.get('/foo', function(req, res, next){99 throw new Error('oh noes');100 });101 95 app.error(function(err, req, res, next){96 if (err.message === 'broken') {97 next(err);98 } else {
3 unmodified lines
102 103 app.error(function(err, req, res, next){104 res.send(err.message, 500);105 });106107 app.get('/', function(req, res, next){108 throw new Error('broken');109 });110 app.get('/foo', function(req, res, next){111 throw new Error('oh noes');112 });113 114 assert.response(app,115 { url: '/' },116 { body: 'broken', status: 500 });
204 unmodified lines