Skip to content

Commit

Permalink
displaying a basic error message if a file can't be located - fixes #95
Browse files Browse the repository at this point in the history
  • Loading branch information
jdan committed Aug 26, 2014
1 parent 0d025db commit d685ed9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit d685ed9

Please sign in to comment.