Skip to content
Myr

error() is passed the exception

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

authored by visionmedia · committed by visionmedia · parent b958393 · Browse files · 2 files+6 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

2 files+6 added−3 removed

  • tests:+4 added−1 removed
  • other:+2 added−2 removed

2 files+6 added−3 removed

modified:lib/express/request.js+2 added-2 removed
296 unmodified lines
297 * When an error route is defined via the DSL it298 * will then be called regardless of any setting that299 * may be present. ("throw exceptions" will still work)300 *301 * error(function(){301 * error(function(err){302 * this.halt(500, 'your app sucks!')303 * })304 *305 * When "html" is accepted, and "show exceptions" is enabled
10 unmodified lines
316 */317 318 error: function(err) {319 if (Express.error)320 Express.error.call(this)320 Express.error.call(this, err)321 else if (this.accepts('html') && set('show exceptions'))322 this.halt(500, showExceptions.render(this, err))323 else324 this.halt(500)
34 unmodified lines
modified:spec/spec.request.js+4 added-1 removed
244 unmodified lines
245 246 describe '#error()'247 describe 'when an error route is defined'248 it 'should be called'249 var err250 disable('throw exceptions')250 error(function(){251 global.error(function(e){252 err = e253 this.halt(500, 'FAIL!')254 })255 get('/', function(){ this.error(new Error('whoop')) })256 get('/').body.should.eql 'FAIL!'257 err.message.should.eql 'whoop'258 end259 end260 261 describe 'when accepting "html"'
106 unmodified lines