Skip to content
This repository
Browse code

Fixed res.partial(); next(err) when no callback is given [reported by…

… aheckmann]
  • Loading branch information...
commit 28ba9e8ac586694bb0857ae03a15ee9355466889 1 parent 7888cb0
TJ Holowaychuk authored
3  lib/view.js
@@ -179,8 +179,9 @@ res.partial = function(view, options, fn){
179 179 if (fn) {
180 180 fn(err);
181 181 } else {
182   - throw err;
  182 + this.req.next(err);
183 183 }
  184 + return;
184 185 }
185 186
186 187 // callback or transfer
1  test/fixtures/error.jade
... ... @@ -0,0 +1 @@
  1 += user.name
12 test/view.test.js
@@ -619,6 +619,18 @@ module.exports = {
619 619 assert.response(app,
620 620 { url: '/root/underscore' },
621 621 { body: '<p>Testing</p>' });
  622 +
  623 + // error in template
  624 +
  625 + app.get('/error', function(req, res){
  626 + process.nextTick(function(){
  627 + res.partial('error');
  628 + });
  629 + });
  630 +
  631 + assert.response(app,
  632 + { url: '/error' },
  633 + { status: 500 });
622 634 },
623 635
624 636 'test #partial() with several calls': function(){

0 comments on commit 28ba9e8

Please sign in to comment.
Something went wrong with that request. Please try again.