From 02ae4f787d68eab7274af63161032407018a2832 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Sun, 8 Sep 2013 11:27:16 -0700 Subject: [PATCH] fix socket "error" handling always has clientError now --- docs/api.md | 1 + lib/application.js | 2 +- lib/context.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/api.md b/docs/api.md index 7b3aa01..fc1df72 100644 --- a/docs/api.md +++ b/docs/api.md @@ -38,6 +38,7 @@ http.createServer(app.callback()).listen(3001); Application settings are properties on the `app` instance, currently the following are supported: + - `app.name` optionally give your application a name - `app.env` defaulting to the __NODE_ENV__ or "development" - `app.proxy` when true proxy header fields will be trusted - `app.subdomainOffset` offset of `.subdomains` to ignore [2] diff --git a/lib/application.js b/lib/application.js index 646d97f..9c70938 100644 --- a/lib/application.js +++ b/lib/application.js @@ -129,7 +129,7 @@ app.callback = function(){ return function(req, res){ var ctx = new self.Context(self, req, res); - if (!ctx.socket.listeners('error').length) { + if (1 == ctx.socket.listeners('error').length) { ctx.socket.on('error', function(err){ self.emit('error', err); }); diff --git a/lib/context.js b/lib/context.js index 27e6a1d..2f367af 100644 --- a/lib/context.js +++ b/lib/context.js @@ -578,7 +578,7 @@ module.exports = { err.status = status || 500; throw err; }, - + /** * Default error handling. *