Expand description
Deterministic-error classification for the CLI exit contract.
Retry wrappers around anodizer (CI actions, shell loops) need to tell a transient failure (network flake, registry 5xx — worth retrying) from a deterministic one (unparseable config, invalid flag values, the dist-not-empty guard — retrying burns attempts on an identical failure). Two signals carry that classification:
- exit code
EXIT_DETERMINISTIC(2) — the Unix usage-error convention; everything else keeps exit 1. - stderr marker
CLASS_MARKER— a machine-readable line for wrappers that cannot rely on the exit code (or pin an older anodizer whose deterministic paths still exited 1).
Classification is a conservative allowlist: an error is deterministic
only if its construction site wrapped it via deterministic /
deterministic_msg. Anything unwrapped — however config-shaped its
message looks — stays exit 1, so a transient failure can never be
misfiled as unretryable.
Structs§
- Deterministic
Error - Transparent marker wrapper: its presence anywhere in an
anyhowchain classifies the whole error as deterministic. Display andsource()forward to the wrapped error, so rendered output (top message +caused by:chain) is byte-identical to the unwrapped error.
Constants§
- CLASS_
MARKER - Machine-readable stderr marker emitted alongside every deterministic
error, mirroring the
anodizer-output <key>=<value>payload convention. - EXIT_
DETERMINISTIC - Exit code for deterministic config/usage errors (Unix usage-error convention, and the code clap already uses for flag-parse errors).
Functions§
- deterministic
- Mark an error as deterministic. The returned error renders identically;
only
is_deterministiccan tell the difference. - deterministic_
msg deterministicfor message-shaped errors — theResult<_, String>validator idiom (.map_err(deterministic_msg)?).- is_
deterministic - True when any link of the chain is a
DeterministicErrormarker — context layered on top of a marked error does not hide it.