config: add error handling

This commit is contained in:
Guillermo Rauch 2016-07-07 07:49:11 -07:00
parent 995206c19b
commit 4e6fc051ec

View file

@ -19,6 +19,11 @@ function exec (str) {
const script = new vm.Script(str);
const mod = {};
script.runInNewContext(mod);
const cfg = mod.exports.config;
if (!cfg) {
throw new Error('Error reading configuration: `config` key is missing');
}
return cfg;
}
exports.init = function () {