Wrap JSON parse errors in resolveExtractor with context

This commit is contained in:
Michael B. Gale
2026-09-22 18:38:53 +01:00
parent 416ff0dea1
commit f042742baf
2 changed files with 15 additions and 2 deletions

View File

@@ -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<string[]> {
const codeqlArgs = [