Merge pull request #82 from mfloryan/fileinfo

Fileinfo
This commit is contained in:
Charlie Robbins 2013-06-21 23:14:20 -07:00
commit 62589145f3
2 changed files with 4 additions and 3 deletions

View file

@ -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);
@ -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 + '].');
}
}

View file

@ -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/);
}
}
}