Skip to content

Commit 8cdb7d8

Browse files
Merge pull request #1234 from github/edoardo/more-tolerant
TRAP Caching: Be tolerant to not finding the extractor
2 parents 03e3453 + 299b774 commit 8cdb7d8

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

lib/trap-caching.js

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/trap-caching.js.map

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

src/trap-caching.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,20 @@ export async function getLanguagesSupportingCaching(
162162
return result;
163163
const resolveResult = await codeql.betterResolveLanguages();
164164
outer: for (const lang of languages) {
165-
if (resolveResult.extractors[lang].length !== 1) continue;
166-
const extractor = resolveResult.extractors[lang][0];
165+
const extractorsForLanguage = resolveResult.extractors[lang];
166+
if (extractorsForLanguage === undefined) {
167+
logger.info(
168+
`${lang} does not support TRAP caching (couldn't find an extractor)`
169+
);
170+
continue;
171+
}
172+
if (extractorsForLanguage.length !== 1) {
173+
logger.info(
174+
`${lang} does not support TRAP caching (found multiple extractors)`
175+
);
176+
continue;
177+
}
178+
const extractor = extractorsForLanguage[0];
167179
const trapCacheOptions =
168180
extractor.extractor_options?.trap?.properties?.cache?.properties;
169181
if (trapCacheOptions === undefined) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy