Skip to content

Commit e6e649a

Browse files
committed
Simplify API error checks
1 parent 40e2646 commit e6e649a

File tree

7 files changed

+42
-10
lines changed

7 files changed

+42
-10
lines changed

lib/analyze-action.js

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

lib/init-action-post.js

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

lib/init-action.js

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

lib/setup-codeql-action.js

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

lib/upload-lib.js

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

lib/upload-sarif-action.js

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

src/api-client.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,12 @@ export function wrapApiConfigurationError(e: unknown) {
283283
const httpError = asHTTPError(e);
284284
if (httpError !== undefined) {
285285
if (
286-
httpError.message.includes("API rate limit exceeded") ||
287-
httpError.message.includes("commit not found") ||
288-
httpError.message.includes("Resource not accessible by integration") ||
289-
/ref .* not found in this repository/.test(httpError.message)
286+
[
287+
/API rate limit exceeded/,
288+
/commit not found/,
289+
/Resource not accessible by integration/,
290+
/ref .* not found in this repository/,
291+
].some((pattern) => pattern.test(httpError.message))
290292
) {
291293
return new ConfigurationError(httpError.message);
292294
}

0 commit comments

Comments
 (0)