Skip to content

Commit 553eef0

Browse files
committed
Add error handling for undefined extractors in language resolution
1 parent b18df17 commit 553eef0

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

lib/entry-points.js

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codeql.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,13 @@ async function getCodeQLForCmd(
994994
// This can be a bit slow due to the JVM startup cost. Instead, get
995995
// the extractor path from resolveLanguages(), which caches its output.
996996
const output = await this.resolveLanguages();
997-
return output.extractors[language][0].extractor_root;
997+
const extractors = output.extractors[language];
998+
if (extractors === undefined) {
999+
throw new Error(
1000+
`Unable to resolve an extractor for the language '${language}'.`,
1001+
);
1002+
}
1003+
return extractors[0].extractor_root;
9981004
},
9991005
async resolveQueriesStartingPacks(queries: string[]): Promise<string[]> {
10001006
const codeqlArgs = [

0 commit comments

Comments
 (0)