error-rail
Composable, lazy-evaluated error handling for Rust.
use *;
Features
- Lazy context — Format strings only when errors occur
- Chainable context — Build rich error traces with
.ctx() - Validation accumulation — Collect all errors, not just the first
- Transient error classification — Built-in retry support
- Error fingerprinting — Deduplicate errors in monitoring systems
- Async-first — Full async/await support with Tower & Tracing integration
no_stdcompatible — Works in embedded and web environments
Quick Start
use *;
Core Concepts
Context Methods
// Static context (zero allocation)
result.ctx
// Lazy formatted context (evaluated only on error)
result.ctx
// Structured context with tags & metadata
result.ctx
Validation (Collect All Errors)
use Validation;
let results: = vec!.into_iter.collect;
// Both errors collected, not just the first
Async Support
use *;
async
Feature Flags
[]
= "0.8" # Core (no_std)
= { = "0.8", = ["std"] } # + backtraces
= { = "0.8", = ["serde"] } # + serde support
= { = "0.8", = ["async"] } # + async support
= { = "0.8", = ["tokio"] } # + retry, timeout
= { = "0.8", = ["tower"] } # + Tower middleware
= { = "0.8", = ["full"] } # Everything
Documentation
| Resource | Description |
|---|---|
| Quick Start | Step-by-step tutorial |
| Async Guide | Async patterns |
| Patterns | Real-world examples |
| Benchmarks | Performance analysis |
| API Docs | Full API reference |
Examples