do-over 0.1.0

Async resilience policies for Rust inspired by Polly
Documentation
//! Error types for do_over policies.
//!
//! This module provides the [`DoOverError`] enum which wraps application errors
//! with policy-specific failure variants.

use thiserror::Error;

/// Error type that wraps application errors with policy-specific failures.
///
/// `DoOverError<E>` allows you to distinguish between infrastructure failures
/// (timeout, circuit open, bulkhead full) and your application's own errors.
///
/// # Type Parameter
///
/// * `E` - Your application's error type
///
/// # Examples
///
/// ```rust
/// use do_over::error::DoOverError;
///
/// fn handle_error<E: std::fmt::Debug>(err: DoOverError<E>) {
///     match err {
///         DoOverError::Timeout => println!("Operation timed out"),
///         DoOverError::CircuitOpen => println!("Circuit breaker is open"),
///         DoOverError::BulkheadFull => println!("Too many concurrent requests"),
///         DoOverError::Inner(e) => println!("Application error: {:?}", e),
///     }
/// }
/// ```
#[derive(Debug, Error)]
pub enum DoOverError<E> {
    /// The operation exceeded its configured timeout duration.
    #[error("operation timed out")]
    Timeout,

    /// The circuit breaker is in the Open state and rejecting requests.
    #[error("circuit breaker is open")]
    CircuitOpen,

    /// The bulkhead or rate limiter rejected the request due to capacity limits.
    #[error("bulkhead rejected execution")]
    BulkheadFull,

    /// An error from the underlying operation.
    #[error(transparent)]
    Inner(E),
}