@zedtech/zedkit-core
Classify failures for retry policy
Typed error kinds plus `classifyError` so workers and HTTP layers pick the same policy.
beta
Usage
At a glance
- Who: Service authors who route failures to retry, dead-letter, or client-facing errors.
- What: Typed error kinds plus
classifyErrorso workers and HTTP layers pick the same policy. - Use when: At domain boundaries and queue consumers where retry vs fail-fast must be explicit.
- Avoid when: For validation-only failures — return a
Resultor map to 400 without throwing.
Install
pnpm add @zedtech/zedkit-coreLatest: 0.1.3 (via changesets).
Example
import { classifyError, DomainError, TransientError } from "@zedtech/zedkit-core";
if (classifyError(err) === "transient") await retryLater();
throw new DomainError("slot_taken", "Slot already booked");
throw new TransientError("upstream timeout", { cause: err });Wraps: (none)