From d685ed9d5bce0e018a301cb6f9e39bf2f161f19e Mon Sep 17 00:00:00 2001 From: Jordan Scales Date: Tue, 26 Aug 2014 12:40:42 -0400 Subject: [PATCH] displaying a basic error message if a file can't be located - fixes #95 --- lib/helper.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/helper.js b/lib/helper.js index 5361c92..2155818 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -178,6 +178,8 @@ function readFilePromise(filename) { fs.readFile(filename, 'utf-8', function (err, contents) { if (err) { debug(err + ' ' + filename); + // TODO: better error handling + deferred.reject(err); } else { debug('read ' + filename); deferred.resolve(contents); @@ -203,6 +205,11 @@ function httpGetPromise(url) { data += chunk; }); + res.on('err', function (err) { + debug(err + ' ' + url); + deferred.reject(err); + }); + res.on('end', function () { if (res.statusCode !== 200) { debug(res.statusCode + ': ' + url);