From ca80d1b8c6e1f03bc7f7b1b31a0d7b317773affd Mon Sep 17 00:00:00 2001 From: Martin Haas Date: Wed, 13 May 2015 10:05:44 +0200 Subject: [PATCH] Call callback on error. --- koubachi.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/koubachi.js b/koubachi.js index 4ef15eb..f5434fa 100644 --- a/koubachi.js +++ b/koubachi.js @@ -89,9 +89,11 @@ Koubachi.prototype.invoke = function(path, body, callback) { callback(null, results); }).on('close', function() { self.logger.error('https', { exception: new Error('premature EOF') }); + return callback(new Error('premature EOF'), null); }); }).on('error', function(err) { self.logger.error('http', { exception: err }); + return callback(err, null); }).end(body); return this;