Skip to content
Myr

Added test for multiple app.error() calls

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 228a781 · Browse files · 1 file+17 added−3 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+17 added−3 removed

  • tests:+17 added−3 removed

1 file+17 added−3 removed

modified:test/express.test.js+17 added-3 removed
86 unmodified lines
87 assert.response(app,88 { url: '/' },89 { body: 'Shit: broken', status: 500 });90 91 // Throwing91 // Multiple error()s92 var app = express.createServer();93 94 app.get('/', function(req, res, params, next){95 throw new Error('broken');96 });97 app.get('/foo', function(req, res, params, next){98 throw new Error('oh noes');99 });100 101 app.error(function(err, req, res, next){99 res.send('rawrrrr: ' + err.message, 500);102 if (err.message === 'broken') {103 next(err);104 } else {105 res.send(500);106 }107 });108 109 app.error(function(err, req, res, next){110 res.send(err.message, 500);111 });112 113 assert.response(app,114 { url: '/' },104 { body: 'rawrrrr: broken', status: 500 });115 { body: 'broken', status: 500 });116 assert.response(app,117 { url: '/foo' },118 { body: 'Internal Server Error' });119 },120 121 'test next()': function(assert){122 var app = express.createServer();
87 unmodified lines