mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
config: add error handling
This commit is contained in:
parent
995206c19b
commit
4e6fc051ec
1 changed files with 5 additions and 0 deletions
|
|
@ -19,6 +19,11 @@ function exec (str) {
|
||||||
const script = new vm.Script(str);
|
const script = new vm.Script(str);
|
||||||
const mod = {};
|
const mod = {};
|
||||||
script.runInNewContext(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 () {
|
exports.init = function () {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue