diff --git a/lib/nconf/stores/file.js b/lib/nconf/stores/file.js index 117f5ab..65ccfa3 100644 --- a/lib/nconf/stores/file.js +++ b/lib/nconf/stores/file.js @@ -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 + '].'); } } diff --git a/test/stores/file-store-test.js b/test/stores/file-store-test.js index 75ec280..bf43d7f 100644 --- a/test/stores/file-store-test.js +++ b/test/stores/file-store-test.js @@ -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/); } } }