Skip to content
Myr

Added app.error() support

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 caed07d · Browse files · 2 files+46 added−0 removed
This commit

State

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

Diff stats

2 files+46 added−0 removed

  • tests:+28 added−0 removed
  • other:+18 added−0 removed

2 files+46 added−0 removed

modified:lib/express/server.js+18 added
modified:test/express.test.js+28 added
57 unmodified lines
58 assert.eql(['one', 'two'], calls);59 });60 },61 62 'test #error()': function(assert){63 var app = express.createServer();64 65 app.get('/', function(req, res, params, next){66 next(new Error('broken'));67 });68 69 app.use('/', connect.errorHandler());70 71 assert.response(app,72 { url: '/' },73 { body: 'Internal Server Error' });74 75 var app = express.createServer();76 77 app.get('/', function(req, res, params, next){78 next(new Error('broken'));79 });80 81 app.error(function(err, req, res, next){82 res.send(err.message, 500);83 });84 85 assert.response(app,86 { url: '/' },87 { body: 'broken', status: 500 });88 },89 90 'test next()': function(assert){91 var app = express.createServer();92 93 app.get('/user.:format?', function(req, res, params, next){
85 unmodified lines