بنقرة واحدة
error-handling-basics
Essential Rust error handling rules for anyhow and thiserror users
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Essential Rust error handling rules for anyhow and thiserror users
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Choosing and profiling the global allocator (jemalloc, mimalloc, system) in the backend-service `service` template
Request lifecycle, Tower layer ordering, and scaling choices in the backend-service `service` template
Observability wiring for the backend-service `service` template: metrique wide-event metrics, tracing logs, and optional dial9 runtime profiling
Setting up automated crate releases with release-plz and OIDC trusted publishing
Standard GitHub Actions CI structure for Rust projects using ci-battery-pack
Cross-platform binary builds for GitHub Releases with cargo-binstall support
| name | error-handling-basics |
| description | Essential Rust error handling rules for anyhow and thiserror users |
Error reporters walk .source() separately. Including it in Display causes double-printing:
// Wrong
#[error("operation failed: {0}")]
MyError(#[source] io::Error)
// Right
#[error("operation failed")]
MyError(#[source] io::Error)
// Wrong: repeats what the source error already says
.context("file not found")
// Right: says what you were trying to do
.context("failed to load user config")
Set RUST_BACKTRACE=1 RUST_LIB_BACKTRACE=0. This gives panic backtraces without the performance cost of capturing one on every anyhow::Error.
For comprehensive patterns (opaque library errors, internal error composition, structured logging, custom application error types), install the error battery pack:
cargo install cargo-bp
cargo bp add error