一键导入
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