assert object type in ctx.onerror

This commit is contained in:
dead_horse 2014-04-25 01:08:08 +08:00
parent 5de9d962a0
commit 6a2ed3e6eb
2 changed files with 5 additions and 2 deletions

View file

@ -3,6 +3,7 @@
* Module dependencies.
*/
var assert = require('assert');
var delegate = require('delegates');
var http = require('http');
@ -86,7 +87,9 @@ var proto = module.exports = {
// don't do anything if there is no error.
// this allows you to pass `this.onerror`
// to node-style callbacks.
if (!err) return;
if (undefined == err) return;
assert(err instanceof Error, 'non-error thrown: ' + err);
// nothing we can do here other
// than delegate to the app-level