Merge pull request #265 from dead-horse/throw-not-error
Throw not error
This commit is contained in:
commit
239c0ce1f9
4 changed files with 5 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
|||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var debug = require('debug')('koa:context');
|
||||
var assert = require('assert');
|
||||
var delegate = require('delegates');
|
||||
var http = require('http');
|
||||
|
||||
|
@ -87,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
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var debug = require('debug')('koa:request');
|
||||
var qs = require('querystring');
|
||||
var typeis = require('type-is');
|
||||
var fresh = require('fresh');
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
var ensureErrorHandler = require('error-inject');
|
||||
var debug = require('debug')('koa:response');
|
||||
var escape = require('escape-html');
|
||||
var onfinish = require('finished');
|
||||
var status = require('statuses');
|
||||
|
|
|
@ -50,4 +50,4 @@ describe('ctx.onerror(err)', function(){
|
|||
done();
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue