Skip to content

Commit a0c5447

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

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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)