Merge 84c536a5e0 into 4583f88626
This commit is contained in:
commit
b9190d1dcf
@ -11,6 +11,7 @@ describe("failover-error", () => {
|
|||||||
expect(resolveFailoverReasonFromError({ statusCode: "429" })).toBe("rate_limit");
|
expect(resolveFailoverReasonFromError({ statusCode: "429" })).toBe("rate_limit");
|
||||||
expect(resolveFailoverReasonFromError({ status: 403 })).toBe("auth");
|
expect(resolveFailoverReasonFromError({ status: 403 })).toBe("auth");
|
||||||
expect(resolveFailoverReasonFromError({ status: 408 })).toBe("timeout");
|
expect(resolveFailoverReasonFromError({ status: 408 })).toBe("timeout");
|
||||||
|
expect(resolveFailoverReasonFromError({ status: 400 })).toBe("format");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("infers format errors from error messages", () => {
|
it("infers format errors from error messages", () => {
|
||||||
|
|||||||
@ -120,6 +120,7 @@ export function resolveFailoverReasonFromError(err: unknown): FailoverReason | n
|
|||||||
if (status === 429) return "rate_limit";
|
if (status === 429) return "rate_limit";
|
||||||
if (status === 401 || status === 403) return "auth";
|
if (status === 401 || status === 403) return "auth";
|
||||||
if (status === 408) return "timeout";
|
if (status === 408) return "timeout";
|
||||||
|
if (status === 400) return "format";
|
||||||
|
|
||||||
const code = (getErrorCode(err) ?? "").toUpperCase();
|
const code = (getErrorCode(err) ?? "").toUpperCase();
|
||||||
if (["ETIMEDOUT", "ESOCKETTIMEDOUT", "ECONNRESET", "ECONNABORTED"].includes(code)) {
|
if (["ETIMEDOUT", "ESOCKETTIMEDOUT", "ECONNRESET", "ECONNABORTED"].includes(code)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user