commit
62589145f3
2 changed files with 4 additions and 3 deletions
|
@ -100,7 +100,7 @@ File.prototype.load = function (callback) {
|
||||||
self.store = self.format.parse(data.toString());
|
self.store = self.format.parse(data.toString());
|
||||||
}
|
}
|
||||||
catch (ex) {
|
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);
|
callback(null, self.store);
|
||||||
|
@ -129,7 +129,7 @@ File.prototype.loadSync = function () {
|
||||||
this.store = data;
|
this.store = data;
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
throw new Error("Error parsing your JSON configuration file.")
|
throw new Error("Error parsing your JSON configuration file: [" + self.file + '].');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,9 @@ vows.describe('nconf/stores/file').addBatch({
|
||||||
topic: function () {
|
topic: function () {
|
||||||
this.store.load(this.callback.bind(null, null));
|
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.isTrue(!!err);
|
||||||
|
assert.match(err, /malformed\.json/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue