What problem does it solve?
Rust projects often struggle with designing robust error handling, including when to use Result or Option, how to define clear error types, and how to propagate rich context across layers. This skill provides a structured approach to error strategy, including domain-driven design, error propagation, and ergonomic messaging for libraries and applications.
Core Features & Use Cases
- Domain-driven error design using thiserror for strong, typed error variants.
- Context-rich propagation with anyhow::Context and proper source chaining.
- Pattern guidance for converting between Option and Result and choosing appropriate wrappers (thiserror, thiserror::Error, From implementations).
- Guidance for library vs application boundaries, testing error scenarios, and ergonomic user-facing messages.
Quick Start
Prompt the AI to evaluate a Rust function that reads a config file and returns Result<Config, AppError>, and propose an error type design and propagation strategy using thiserror and anyhow.