---
description: Rust Error Handling
globs: "**/*.rs"
alwaysApply: false
---
# Rust Error Handling Practices

Detailed error handling guidelines are maintained in:

- `.claude/skills/handling-rust-errors/SKILL.md` - Main guidelines
- `.claude/skills/handling-rust-errors/resources/` - Detailed patterns

## Quick Reference

Use error-stack (`Report<MyError>`) instead of anyhow or eyre:

```rust
use error_stack::{Report, ResultExt as _};

// Define errors with derive_more
#[derive(Debug, derive_more::Display)]
pub enum MyError {
    #[display("Resource `{id}` not found")]
    NotFound { id: String },
}

impl core::error::Error for MyError {}

// Propagate with context
some_result
    .change_context(MyError::Failed)
    .attach("additional context")?;
```
