[config] throw if config file has a syntax error (elastic/kibana-plugin-helpers#65)

(cherry picked from commit elastic/kibana-plugin-helpers@487dd70bdb)

Original commit: elastic/kibana-plugin-helpers@04026d9322
This commit is contained in:
Spencer 2018-02-05 15:37:22 -07:00 committed by spalger
parent 1e2769b613
commit ef3cb80e04

View file

@ -20,7 +20,10 @@ module.exports = function (root) {
const content = JSON.parse(readFileSync(resolve(root, configFile)));
config = Object.assign(config, content);
} catch (e) {
// noop
// rethrow error unless it's complaining about file not existing
if (e.code !== 'ENOENT') {
throw e;
}
}
});