Add error handling for undefined extractors in language resolution

This commit is contained in:
Mario Campos
2026-06-18 10:36:50 -05:00
parent b18df17ee7
commit 553eef0d3f
2 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -154094,7 +154094,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
}, },
async resolveExtractor(language) { async resolveExtractor(language) {
const output = await this.resolveLanguages(); const output = await this.resolveLanguages();
return output.extractors[language][0].extractor_root; const extractors = output.extractors[language];
if (extractors === void 0) {
throw new Error(
`Unable to resolve an extractor for the language '${language}'.`
);
}
return extractors[0].extractor_root;
}, },
async resolveQueriesStartingPacks(queries) { async resolveQueriesStartingPacks(queries) {
const codeqlArgs = [ const codeqlArgs = [
+7 -1
View File
@@ -994,7 +994,13 @@ async function getCodeQLForCmd(
// This can be a bit slow due to the JVM startup cost. Instead, get // This can be a bit slow due to the JVM startup cost. Instead, get
// the extractor path from resolveLanguages(), which caches its output. // the extractor path from resolveLanguages(), which caches its output.
const output = await this.resolveLanguages(); const output = await this.resolveLanguages();
return output.extractors[language][0].extractor_root; const extractors = output.extractors[language];
if (extractors === undefined) {
throw new Error(
`Unable to resolve an extractor for the language '${language}'.`,
);
}
return extractors[0].extractor_root;
}, },
async resolveQueriesStartingPacks(queries: string[]): Promise<string[]> { async resolveQueriesStartingPacks(queries: string[]): Promise<string[]> {
const codeqlArgs = [ const codeqlArgs = [