upgrade co@4

This commit is contained in:
dead_horse 2014-11-17 21:21:00 +08:00
parent 193eadbdb5
commit 3f183a196b
2 changed files with 3 additions and 3 deletions

View file

@ -113,7 +113,7 @@ app.use = function(fn){
app.callback = function(){ app.callback = function(){
var mw = [respond].concat(this.middleware); var mw = [respond].concat(this.middleware);
var gen = compose(mw); var gen = compose(mw);
var fn = co(gen); var fn = co.wrap(gen);
var self = this; var self = this;
if (!this.listeners('error').length) this.on('error', this.onerror); if (!this.listeners('error').length) this.on('error', this.onerror);
@ -122,7 +122,7 @@ app.callback = function(){
res.statusCode = 404; res.statusCode = 404;
var ctx = self.createContext(req, res); var ctx = self.createContext(req, res);
onFinished(res, ctx.onerror); onFinished(res, ctx.onerror);
fn.call(ctx, ctx.onerror); fn.call(ctx).catch(ctx.onerror);
} }
}; };

View file

@ -19,7 +19,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"accepts": "^1.1.0", "accepts": "^1.1.0",
"co": "^3.1.0", "co": "^4.0.0",
"content-disposition": "~0.5.0", "content-disposition": "~0.5.0",
"cookies": "~0.5.0", "cookies": "~0.5.0",
"debug": "*", "debug": "*",