Simplify API error checks

This commit is contained in:
Henry Mercer
2025-10-21 10:31:41 +01:00
parent 40e26468f3
commit e6e649a8f3
7 changed files with 42 additions and 10 deletions

View File

@@ -283,10 +283,12 @@ export function wrapApiConfigurationError(e: unknown) {
const httpError = asHTTPError(e);
if (httpError !== undefined) {
if (
httpError.message.includes("API rate limit exceeded") ||
httpError.message.includes("commit not found") ||
httpError.message.includes("Resource not accessible by integration") ||
/ref .* not found in this repository/.test(httpError.message)
[
/API rate limit exceeded/,
/commit not found/,
/Resource not accessible by integration/,
/ref .* not found in this repository/,
].some((pattern) => pattern.test(httpError.message))
) {
return new ConfigurationError(httpError.message);
}