fix(infra): treat undici fetch failed as transient unhandled rejection

This commit is contained in:
Peter Steinberger
2026-02-22 17:05:20 +01:00
parent dbc1ed8933
commit 824d1e095b
3 changed files with 10 additions and 5 deletions

View File

@@ -79,6 +79,12 @@ describe("isTransientNetworkError", () => {
expect(isTransientNetworkError(error)).toBe(true);
});
it("returns true for fetch failed with unclassified cause", () => {
const cause = Object.assign(new Error("unknown socket state"), { code: "UNKNOWN" });
const error = Object.assign(new TypeError("fetch failed"), { cause });
expect(isTransientNetworkError(error)).toBe(true);
});
it("returns true for nested cause chain with network error", () => {
const innerCause = Object.assign(new Error("connection reset"), { code: "ECONNRESET" });
const outerCause = Object.assign(new Error("wrapper"), { cause: innerCause });