fix(telegram): classify undici fetch errors as recoverable for retry (#16699)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 67b5bce44f
Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
Glucksberg
2026-02-22 06:46:11 -04:00
committed by GitHub
parent 38f02c7a32
commit 2739328508
5 changed files with 49 additions and 9 deletions

View File

@@ -169,8 +169,12 @@ describe("monitorTelegramProvider (grammY)", () => {
expect(api.sendMessage).not.toHaveBeenCalled();
});
it("retries on recoverable network errors", async () => {
const networkError = Object.assign(new Error("timeout"), { code: "ETIMEDOUT" });
it("retries on recoverable undici fetch errors", async () => {
const networkError = Object.assign(new TypeError("fetch failed"), {
cause: Object.assign(new Error("connect timeout"), {
code: "UND_ERR_CONNECT_TIMEOUT",
}),
});
runSpy
.mockImplementationOnce(() => ({
task: () => Promise.reject(networkError),