rust-errorslisted
Install: claude install-skill Dankosik/rust-service-template-rest
# Rust Errors
**Failure semantics.** Follow failure from the operation that knows what happened to the boundary that reports it, and let each hop decide one thing: stop, degrade, or continue. Honor supplied requirements and preserve settled choices outside the requested change; resolve only what the task leaves open.
Library crates define typed errors with thiserror, one enum per owner, preserving the cause through a source and adding useful context such as the configuration key or resource. Display stays operator-readable and never re-exposes a secret; secret strings print as redacted, and error text must not undo that. Classify structured errors by variant rather than by matching display strings. Retain typed distinctions where callers choose different recovery behavior; an opaque wrapper is acceptable only at the composition root.
The transport edge is the only place an error becomes client-visible. Problem responses render the closed code catalog with stable type, title, and status; an unclassified failure uses the sanitized detail so a caller cannot tell which internal path broke. A code without a matching response in the API contract is unreachable, not wrong. Adding a code means adding it to the catalog and its coverage test, never emitting an ad-hoc status.
Startup failures return through the entry function, which prints the message and exits with failure; a teardown that overran a budget exits with a distinct code so the platform can tell it from a crash; process