From 9420c3bec8431bd1818f093a965365e78f00ed5d Mon Sep 17 00:00:00 2001 From: John Dierks Date: Mon, 17 Oct 2016 16:08:14 -0700 Subject: [PATCH] Fixed multiple callbacks, and error handling --- lib/GeckoboardPushSend.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/GeckoboardPushSend.js b/lib/GeckoboardPushSend.js index abb4a6a..d0569b8 100644 --- a/lib/GeckoboardPushSend.js +++ b/lib/GeckoboardPushSend.js @@ -39,8 +39,8 @@ GeckoboardPushSend.prototype.send = function(data, callback){ } } if(typeof callback == 'function'){ - if(response.success == false){ - callback(response.error); + if(!response.success){ + callback(response.message); }else{ callback(null, response); } @@ -51,9 +51,7 @@ GeckoboardPushSend.prototype.send = function(data, callback){ }); req.on('error', function(e) { - if(typeof callback == 'function'){ - callback(e.message); - } + console.log('Error:',e); }); // write data to request body