Merge pull request #484 from promasu/master

Log errors in faulty custom config file
This commit is contained in:
ansuz 2020-01-04 18:28:14 -05:00 committed by GitHub
commit 1cf95e6dae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,14 @@ try {
console.log("You can configure the administrator email (adminEmail) in your config/config.js file"); console.log("You can configure the administrator email (adminEmail) in your config/config.js file");
} }
} catch (e) { } catch (e) {
console.log("Config not found, loading the example config. You can customize the configuration by copying config/config.example.js to " + configPath); if (e instanceof SyntaxError) {
console.error("config/config.js is faulty. See stacktrace below for more information. Terminating. \n");
console.error(e.name + ": " + e.message);
console.error(e.stack.split("\n\n")[0]);
process.exit(1);
} else {
console.log("Config not found, loading the example config. You can customize the configuration by copying config/config.example.js to " + configPath);
}
config = require("../config/config.example"); config = require("../config/config.example");
} }
module.exports = config; module.exports = config;