Skip to content

Commit

Permalink
Merge pull request #82 from mfloryan/fileinfo
Browse files Browse the repository at this point in the history
Fileinfo
  • Loading branch information
indexzero committed Jun 22, 2013
2 parents 818526c + ada15db commit 6258914
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/nconf/stores/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ File.prototype.load = function (callback) {
self.store = self.format.parse(data.toString());
}
catch (ex) {
return callback(new Error("Error parsing your JSON configuration file."));
return callback(new Error("Error parsing your JSON configuration file: [" + self.file + '].'));
}

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

Expand Down
3 changes: 2 additions & 1 deletion test/stores/file-store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ vows.describe('nconf/stores/file').addBatch({
topic: function () {
this.store.load(this.callback.bind(null, null));
},
"should respond with an error": function (_, err) {
"should respond with an error and indicate file name": function (_, err) {
assert.isTrue(!!err);
assert.match(err, /malformed\.json/);
}
}
}
Expand Down

0 comments on commit 6258914

Please sign in to comment.