Skip to content

Commit

Permalink
Adding helpful information in case parsing failed.
Browse files Browse the repository at this point in the history
I stumbled over 2 slight problems of broken configuration files:

1) It said that a error in my JSON file existed (even though it was a yaml file, parsed by libyaml)
2) It didn't tell me which error occured.

both should be fixed with this PR
  • Loading branch information
martinheidegger committed Mar 9, 2014
1 parent 8105c76 commit c8b6c98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/nconf/stores/file.js
Expand Up @@ -105,7 +105,7 @@ File.prototype.load = function (callback) {

}
catch (ex) {
return callback(new Error("Error parsing your JSON configuration file: [" + self.file + '].'));
return callback(new Error("Error parsing your configuration file: [" + self.file + ']: ' + ex.message));
}

callback(null, self.store);
Expand Down Expand Up @@ -138,7 +138,7 @@ File.prototype.loadSync = function () {
this.store = data;
}
catch (ex) {
throw new Error("Error parsing your JSON configuration file: [" + self.file + '].');
throw new Error("Error parsing your configuration file: [" + self.file + ']: ' + ex.message);
}
}

Expand Down

0 comments on commit c8b6c98

Please sign in to comment.