fix(failover): widen raw 402 detection for third-party proxy messages

This commit is contained in:
junyuc25
2026-03-14 00:06:24 -07:00
committed by Altay
parent eaaab098fb
commit c96b9a3a07
2 changed files with 8 additions and 0 deletions

View File

@@ -1014,6 +1014,12 @@ describe("classifyFailoverReason", () => {
"402 You've used up your points! Visit https://poe.com/api/keys to get more.",
),
).toBe("billing");
// Third-party proxy 402 with non-standard wording (#45774)
expect(
classifyFailoverReason(
"402 No available asset for API access, please purchase a subscription",
),
).toBe("billing");
expect(classifyFailoverReason(INSUFFICIENT_QUOTA_PAYLOAD)).toBe("billing");
expect(classifyFailoverReason("deadline exceeded")).toBe("timeout");
expect(classifyFailoverReason("request ended without sending any chunks")).toBe("timeout");

View File

@@ -217,6 +217,8 @@ export function isBillingErrorMessage(raw: string): boolean {
value.includes("upgrade") ||
value.includes("credits") ||
value.includes("payment") ||
value.includes("purchase") ||
value.includes("subscription") ||
value.includes("plan")
);
}