diff --git a/cli/index.ts b/cli/index.ts index 5c02a6f3..7bb27bb2 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -357,8 +357,13 @@ function handleError(error: Error) { } function getObjectOrJSON(options) { - return options && typeof options === 'string' - ? JSON.parse(options) : options - ? options - : {}; + try { + return options && typeof options === 'string' + ? JSON.parse(options) : options + ? options + : {}; + } catch (e) { + console.log(`Encountered error:\n${options}\nis not a valid JSON.`); + handleError(e); + } }