Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides Rust service error handling and observability: thiserror and anyhow, HTTP response mapping, tracing spans, and secret redaction.
Use this skill ↓91% 95%+5 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 20 of 22 without it.
I am writing a database repository module in Rust using SQLx. When a database query fails due to connection timeouts, disk errors, or syntax issues, how should the repository wrap errors before returning to service callers?
The repository wraps database failures using anyhow or an opaque error type.
3 of 3 safety checks passed
Use this skill to make Rust service failures understandable to operators while keeping user-facing responses safe. Treat error handling and telemetry as one design surface.
thiserror for expected branches that callers
should match on.anyhow or opaque application
errors when callers should not match every dependency failure.ResponseError,
Axum IntoResponse, or a small adapter function.unwrap, expect, or stringly map_err in service paths unless the
invariant is local and the panic message is useful.Read references/error-boundaries.md when choosing between thiserror,
anyhow, opaque errors, and framework response adapters.
Next to this one in the catalogue, plus more from the same author.