Merge pull request #391 from ssenge/master

More detailed error message in case config file couldn't be loaded.
This commit is contained in:
Michael Teeuw 2016-08-05 19:53:13 +02:00 committed by GitHub
commit 68e5a9dfda

View File

@ -41,8 +41,16 @@ var App = function() {
var config = Object.assign(defaults, c);
callback(config);
} catch (e) {
console.error("WARNING! Could not find config. Please create one.");
if (e.code == "ENOENT") {
console.error("WARNING! Could not find config file. Please create one. Starting with default configuration.");
callback(defaults);
} else if (e instanceof ReferenceError || e instanceof SyntaxError) {
console.error("WARNING! Could not validate config file. Please correct syntax errors. Starting with default configuration.");
callback(defaults);
} else {
console.error("WARNING! Could not load config file. Starting with default configuration. Error found: " + e);
callback(defaults);
}
}
};