Nicer handling of config file errors at startup

This commit is contained in:
Bryan Ashby 2020-06-18 21:29:24 -06:00
parent ce15511cf1
commit 20bbbd2f59
No known key found for this signature in database
GPG key ID: B49EB437951D2542
3 changed files with 15 additions and 4 deletions

View file

@ -54,6 +54,8 @@ function printVersionAndExit() {
}
function main() {
let errorDisplayed = false;
async.waterfall(
[
function processArgs(callback) {
@ -87,7 +89,14 @@ function main() {
configPathSupplied = null; // make non-fatal; we'll go with defaults
}
} else {
console.error(err.message);
errorDisplayed = true;
console.error(`Configuration error: ${err.message}`); // eslint-disable-line no-console
if (err.hint) {
console.error(`Hint: ${err.hint}`);
}
if (err.configPath) {
console.error(`Note: ${err.configPath}`);
}
}
}
return callback(err);
@ -114,7 +123,7 @@ function main() {
});
}
if(err) {
if(err && !errorDisplayed) {
console.error('Error initializing: ' + util.inspect(err));
}
}