Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Ecosystem Comparison: orion-error vs anyhow / thiserror / color-eyre

Scope: anyhow / thiserror / color-eyre / orion-error


1. Positioning

Dimensionanyhowthiserrorcolor-eyreorion-error
PositioningQuick error handlingStandard error deriveDiagnostic error reportingStructured error governance framework
Target usersApp developers (rapid prototyping)Library authorsApp developers (diagnostics)Large multi-team projects
Problem domainReduce error handling boilerplateReduce Error impl boilerplateImprove error diagnostic outputUnified error modeling → runtime propagation → boundary protocol projection
Abstraction levelType erasureType-safe enumType erasure + diagnosticsGeneric structured carrier

2. Core Capabilities

Error Definition

Capabilityanyhowthiserrorcolor-eyreorion-error
Custom error typesNot directly#[derive(Error)]Not directly#[derive(OrionError)]
Generic error typeBox<dyn Error>User-defined enumBox<dyn Error>StructError<T: DomainReason>
Stable identityNoNoNostable_code() + ErrorCategory
Numeric ErrorCodeNoVia #[error(...)]NoBuilt-in error_code()
Display / sourceAutoAutoAutoAuto (OrionError derive)

Runtime Propagation

Capabilityanyhowthiserrorcolor-eyreorion-error
Context attachment.context() / .with_context()No.sections() / .note()OperationContext (doing/at/path + KV + metadata)
Context pathSingle-layer contextNoSingle-layerMulti-layer nested path via target_path()
Custom metadataNo (message only)NoSection traitErrorMetadata (typed KV, not in Display)
Source chainStandard chainStandard chainStandard + SpanTraceDual-channel (Std/Struct) + rich SourceFrame
Cross-type conversionanyhow!() macro#[from]eyre!() macrosource_err() / conv_err()

Boundary Output

Capabilityanyhowthiserrorcolor-eyreorion-error
Human diagnostics.display_chain()NoColored outputreport().render() + RedactPolicy
Protocol JSON (HTTP/RPC)NoNoNoexposure()to_*_error_json()
Stable snapshotNoNoNoStableErrorSnapshot + versioned schema
Exposure policyNoNoNoExposurePolicy (status/visibility/hints/retryable)
RedactionNoNoLimitedRedactPolicy trait

std::error::Error Ecosystem

Capabilityanyhowthiserrorcolor-eyreorion-error
Implements StdErrorYesYesYesExplicit bridge (as_std() / into_std())
dyn Error compatibleNativelyNativelyNativelyLossy (OwnedDynStdStructError)
Third-party interop.context() / anyhow!()#[from].sections() / eyre!()source_err() / raw_source()

3. Coexistence Strategy

LayerRecommended
Outside boundary (3rd-party libs, FFI)thiserror / standard Error trait
Entering structured systemorion-error source_err()
Business layer propagationorion-error StructError<R>
Cross-layer (repo → service → handler)orion-error conv_err()
Boundary outputorion-error exposure()
Quick prototyping / glue codeanyhow (supported via anyhow feature)
Terminal diagnosticsorion-error report().render() or color-eyre

4. When to Use What

Choose orion-error

  • Multi-layer Rust backend services (repo → service → handler → protocol)
  • External HTTP/RPC/gRPC interfaces with unified error responses
  • Microservices with stable error codes and monitoring classification
  • Multi-team projects needing consistent error conventions
  • Persistent/versioned error snapshots

Choose alternatives

  • Single-file scripts or CLI tools → anyhow
  • Low-level libraries exposing std::error::Error → thiserror
  • Terminal applications needing pretty error output → color-eyre
  • Projects with only 1-2 layers, no structured context needed → thiserror + anyhow