From c8b6c98c7a2315f7486737b9e3fc2544842b410d Mon Sep 17 00:00:00 2001 From: Martin Heidegger Date: Sun, 9 Mar 2014 21:40:10 +0900 Subject: [PATCH] Adding helpful information in case parsing failed. 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 --- lib/nconf/stores/file.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nconf/stores/file.js b/lib/nconf/stores/file.js index 6c1a56f2..729d5f03 100644 --- a/lib/nconf/stores/file.js +++ b/lib/nconf/stores/file.js @@ -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); @@ -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); } }