From cc8c4915f9784d76828207d4c2206a974844fd58 Mon Sep 17 00:00:00 2001 From: knotteye Date: Fri, 30 Oct 2020 07:38:01 -0500 Subject: [PATCH] Distinguish between errors when loading the config file. --- src/config.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index a68abaa..4c641a4 100644 --- a/src/config.ts +++ b/src/config.ts @@ -4,7 +4,17 @@ try { var localconfig: Object = parse(read('config/config.yml')); console.log('Config file found.'); } catch (e) { - console.log('No config file found. Exiting.'); + if(e['reason']) { + console.log('Error parsing config on line '+e['mark']['line']+', with reason: '+e['reason']); + } + else { + console.log('Config Error: '+e['code']); + switch(e['code']){ + case 'ENOENT': + console.log('Does the file exist?'); + break; + } + } process.exit(); } const config: Object = {