From 47237814c5a6d0551412f4e59dc69c65e83ea95c Mon Sep 17 00:00:00 2001 From: Mordechai Gerstley Date: Mon, 25 Apr 2022 13:16:13 +0200 Subject: [PATCH] fix(config): add file path to error message when parsing fails (#608) --- lib/config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/config.js b/lib/config.js index 3fb937d..ec7aa92 100644 --- a/lib/config.js +++ b/lib/config.js @@ -25,7 +25,11 @@ export function getMergedConfig(dir, home) { export function getConfig(configType, dir) { const configPath = getConfigPath(configType, dir); - return readJson(configPath); + try { + return readJson(configPath); + } catch (cause) { + throw new Error('Unable to parse config file ' + configPath, { cause }); + } }; export function getConfigPath(configType, dir) {