Skip to content
Myr

handle thrown errors inside Route

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

close #2029

authored by Roman Shtylman · committed by Roman Shtylman · parent 1ee5329 · Browse files · 2 files+38 added−2 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+38 added−2 removed

  • tests:+27 added−0 removed
  • other:+11 added−2 removed

2 files+38 added−2 removed

modified:lib/router/route.js+11 added-2 removed
modified:test/Route.js+27 added
138 unmodified lines
139 });140141 route.dispatch({ method: 'get' }, {});142 })143144 it('should handle throw', function(done) {145 var route = new Route('');146147 var order = '';148 route.all(function(req, res, next){149 throw new Error('foobar');150 });151152 route.all(function(req, res, next){153 order += '0';154 next();155 });156157 route.all(function(err, req, res, next){158 order += 'a';159 next(err);160 });161162 route.all(function(err, req, res, next){163 assert.equal(err.message, 'foobar');164 assert.equal(order, 'a');165 done();166 });167168 route.dispatch({ method: 'get' }, {});169 });170 })171})