Merge pull request #265 from dead-horse/throw-not-error

Throw not error
This commit is contained in:
TJ Holowaychuk 2014-04-24 17:58:04 -07:00
commit 239c0ce1f9
4 changed files with 5 additions and 5 deletions

View file

@ -3,7 +3,7 @@
* Module dependencies. * Module dependencies.
*/ */
var debug = require('debug')('koa:context'); var assert = require('assert');
var delegate = require('delegates'); var delegate = require('delegates');
var http = require('http'); var http = require('http');
@ -87,7 +87,9 @@ var proto = module.exports = {
// don't do anything if there is no error. // don't do anything if there is no error.
// this allows you to pass `this.onerror` // this allows you to pass `this.onerror`
// to node-style callbacks. // 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 // nothing we can do here other
// than delegate to the app-level // than delegate to the app-level

View file

@ -3,7 +3,6 @@
* Module dependencies. * Module dependencies.
*/ */
var debug = require('debug')('koa:request');
var qs = require('querystring'); var qs = require('querystring');
var typeis = require('type-is'); var typeis = require('type-is');
var fresh = require('fresh'); var fresh = require('fresh');

View file

@ -4,7 +4,6 @@
*/ */
var ensureErrorHandler = require('error-inject'); var ensureErrorHandler = require('error-inject');
var debug = require('debug')('koa:response');
var escape = require('escape-html'); var escape = require('escape-html');
var onfinish = require('finished'); var onfinish = require('finished');
var status = require('statuses'); var status = require('statuses');