What problem does it solve?
This Skill guides Rust developers in implementing robust error handling using Result, Option, thiserror, and anyhow to build reliable libraries and applications.
Core Features & Use Cases
- Patterns for library errors with thiserror and application errors with anyhow to provide clear error types and contexts.
- Propagation and mapping of errors with the ? operator, context enrichment, and conversions between Option and Result.
- Real-world scenarios include building CLI tools, services, and crates that require consistent error reporting and user-facing messages.
Quick Start
Create a new Rust project or open an existing one and add dependencies in Cargo.toml: thiserror and anyhow. Create a simple error enum with thiserror and propagate errors using ? in a function that reads a file and parses JSON. Run the code to observe the error context and the error chain produced by anyhow.