From 437d5fa86654d8e4914d983194588ab24aadcb30 Mon Sep 17 00:00:00 2001 From: Geoffrey Hendrey Date: Sun, 18 Feb 2024 10:42:44 -0800 Subject: [PATCH] handle errors in options better --- src/CliCore.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CliCore.ts b/src/CliCore.ts index 52cb380c..4591b708 100644 --- a/src/CliCore.ts +++ b/src/CliCore.ts @@ -65,7 +65,12 @@ export default class CliCore { }else { tags = tags.split(',').map(s => s.trim()); //tags are provided as JSON array } - options = JSON.parse(options); + try { + options = JSON.parse(options); + }catch(e){ + console.error("failed to parse --options json: " + e.message); + throw e; + } filepath = filepath?filepath:bareArgs[0]; oneshot = oneshot===true?oneshot:bareArgs.length > 0;