From 1c20f0f1181fa862b2b98e32bb740706839512cd Mon Sep 17 00:00:00 2001 From: Jurie-Jan Botha Date: Tue, 28 Feb 2012 11:56:43 +0200 Subject: [PATCH 1/3] Implemented rerouting of http client errors to callback --- lib/soda/client.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/soda/client.js b/lib/soda/client.js index b892c23..449cfd6 100755 --- a/lib/soda/client.js +++ b/lib/soda/client.js @@ -86,6 +86,11 @@ Client.prototype.command = function(cmd, args, fn){ // HTTP client var client = http.createClient(this.port, this.host); + // Send HTTP client errors to callback + client.on('error', function(err) { + fn(err); + }); + // Path construction var path = this.commandPath(cmd, args); @@ -108,6 +113,9 @@ Client.prototype.command = function(cmd, args, fn){ req = client.request('GET' , path , { Host: this.host + (this.port ? ':' + this.port : '') }); + req.on('error', function(exception) { + + }); } req.on('response', function(res){ From 71729193d1b3e62e2284afd204b42abb335b2dc3 Mon Sep 17 00:00:00 2001 From: Jurie-Jan Botha Date: Wed, 29 Feb 2012 10:06:13 +0200 Subject: [PATCH 2/3] Removed unused error event on request --- lib/soda/client.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/soda/client.js b/lib/soda/client.js index 449cfd6..62b0847 100755 --- a/lib/soda/client.js +++ b/lib/soda/client.js @@ -113,9 +113,6 @@ Client.prototype.command = function(cmd, args, fn){ req = client.request('GET' , path , { Host: this.host + (this.port ? ':' + this.port : '') }); - req.on('error', function(exception) { - - }); } req.on('response', function(res){ From 2672e83d5e17c55f981d1b4b6ef857ecfdb56d13 Mon Sep 17 00:00:00 2001 From: Jurie-Jan Botha Date: Thu, 29 Nov 2012 09:12:52 +0200 Subject: [PATCH 3/3] Implemented routing of request errors to callback --- lib/soda/client.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/soda/client.js b/lib/soda/client.js index cbd3e99..a8dea41 100755 --- a/lib/soda/client.js +++ b/lib/soda/client.js @@ -129,6 +129,10 @@ Client.prototype.command = function(cmd, args, fn){ return this; }); + req.on('error', function(err) { + fn(err); + }); + if(postData) { req.write(postData); }