From 3f183a196bf8008d02ea0008c68df50a6faba980 Mon Sep 17 00:00:00 2001 From: dead_horse Date: Mon, 17 Nov 2014 21:21:00 +0800 Subject: [PATCH] upgrade co@4 --- lib/application.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/application.js b/lib/application.js index 1b1766d..866a1b8 100644 --- a/lib/application.js +++ b/lib/application.js @@ -113,7 +113,7 @@ app.use = function(fn){ app.callback = function(){ var mw = [respond].concat(this.middleware); var gen = compose(mw); - var fn = co(gen); + var fn = co.wrap(gen); var self = this; if (!this.listeners('error').length) this.on('error', this.onerror); @@ -122,7 +122,7 @@ app.callback = function(){ res.statusCode = 404; var ctx = self.createContext(req, res); onFinished(res, ctx.onerror); - fn.call(ctx, ctx.onerror); + fn.call(ctx).catch(ctx.onerror); } }; diff --git a/package.json b/package.json index 5466584..c0f2a37 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "license": "MIT", "dependencies": { "accepts": "^1.1.0", - "co": "^3.1.0", + "co": "^4.0.0", "content-disposition": "~0.5.0", "cookies": "~0.5.0", "debug": "*",