diff --git a/lib/swedishword.js b/lib/swedishword.js index 2c9ad07..a51c4db 100644 --- a/lib/swedishword.js +++ b/lib/swedishword.js @@ -37,9 +37,14 @@ module.exports = { } }); - }); + }, function(error, response, body) { + if(response.statusCode !== 200) { + logger.error(response.statusCode); + logger.error(body); + } + }); } }; -//module.exports.getSwedishWord(); \ No newline at end of file +//module.exports.getSwedishWord(); diff --git a/lib/today.js b/lib/today.js index d082c25..b12900c 100644 --- a/lib/today.js +++ b/lib/today.js @@ -154,6 +154,11 @@ module.exports = { }); todayCache.data.history = todayCache.data.history.concat(output); console.log(todayCache.data.history); + }, function(error, response, body) { + if(response.statusCode !== 200) { + logger.error(response.statusCode); + logger.error(body); + } }); }, getHistory: function () { @@ -188,7 +193,12 @@ module.exports = { console.log(todayCache.data.history); module.exports.getTechHistory(); - }); + }, function(error, response, body) { + if(response.statusCode !== 200) { + logger.error(response.statusCode); + logger.error(body); + } + }); }, getTrainUpdates: function (id) { console.log('Getting train events...'); @@ -244,7 +254,12 @@ module.exports = { } todayCache.data.trains.data = _.uniq(todayCache.data.trains.data); - }); + }, function(error, response, body) { + if(response.statusCode !== 200) { + logger.error(response.statusCode); + logger.error(body); + } + }); todayCache.data.trains.last = now; diff --git a/lib/train.js b/lib/train.js index 733357c..ed003e7 100644 --- a/lib/train.js +++ b/lib/train.js @@ -174,6 +174,9 @@ function Query(callback, r, host, path) { response.on('end', function () { callback(JSON.parse(data), r); }); + response.on('error', function(e) { + console.error(e); + }); }).end(); } catch (e) { console.log(e);