Skip to main content

Crate toobad

Crate toobad 

Source
Expand description

Error handling library with context attachment and ergonomic macros.

This library provides a unified error type that wraps any Error + Send + Sync, a trait for attaching context messages to failures, and macros for convenient error creation and early return.

§Key Types

  • Error - Main error type that wraps dynamic errors.
  • Context - Trait for adding context to errors.
  • Result - Type alias for Result<T, Error>.

§Macros

  • toobad! - Create an error from a formatted message.
  • bail! - Return an error early from a function.
  • ensure! - Conditionally bail if a condition is false.

Macros§

bail
Return early with an error from the current function.
ensure
Bail if a condition is false.
toobad
Create an error from a formatted message.

Structs§

Error
Unified error type that wraps any Error + Send + Sync.

Traits§

Context
Trait for attaching context to errors.

Type Aliases§

Result