property RetryOptions.when

Which failures are worth another attempt. Returning false rethrows immediately, spending no further attempts and no delay.

Retrying everything is the wrong default for a KNOWN flake: a genuinely broken call — a missing binary, a bad profile — gets a pointless second run and the "we only tolerate this one upstream bug" documentation disappears from the code. This is tokio-retry's retry_if condition. (backoff reaches the same place from the other side, by making the error type say Transient or Permanent; a predicate is the lighter fit here, because the declared- vs-bug axis is already what this library's error types encode.)

Type

(
error: unknown,
attempt: number
) => boolean

Usage

import { type RetryOptions } from "lib/task/task.ts";