diff --git a/lib/entry-points.js b/lib/entry-points.js index 3fbacc32e..38ca1d699 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -153261,7 +153261,14 @@ async function getCodeQLForCmd(logger, cmd, checkVersion) { } } ).exec(); - return JSON.parse(extractorPath); + try { + return JSON.parse(extractorPath); + } catch (err) { + throw new Error( + `Failed to parse extractor path for '${language}' from CLI: ${getErrorMessage(err)} +Output was: ${extractorPath}` + ); + } }, async resolveQueriesStartingPacks(queries) { const codeqlArgs = [ diff --git a/src/codeql.ts b/src/codeql.ts index 65e73d945..2dfc65996 100644 --- a/src/codeql.ts +++ b/src/codeql.ts @@ -951,7 +951,13 @@ async function getCodeQLForCmd( }, }, ).exec(); - return JSON.parse(extractorPath) as string; + try { + return JSON.parse(extractorPath) as string; + } catch (err) { + throw new Error( + `Failed to parse extractor path for '${language}' from CLI: ${getErrorMessage(err)}\nOutput was: ${extractorPath}`, + ); + } }, async resolveQueriesStartingPacks(queries: string[]): Promise { const codeqlArgs = [