From 4e6fc051eca89038dbf7997992f41d6d54473b62 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Thu, 7 Jul 2016 07:49:11 -0700 Subject: [PATCH] config: add error handling --- config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config.js b/config.js index 8a5dc415..0f6d19d2 100644 --- a/config.js +++ b/config.js @@ -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 () {