pub enum DoOverError<E> {
Timeout,
CircuitOpen,
BulkheadFull,
Inner(E),
}Expand description
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
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),
}
}Variants§
Timeout
The operation exceeded its configured timeout duration.
CircuitOpen
The circuit breaker is in the Open state and rejecting requests.
BulkheadFull
The bulkhead or rate limiter rejected the request due to capacity limits.
Inner(E)
An error from the underlying operation.
Trait Implementations§
Source§impl<E: Debug> Debug for DoOverError<E>
impl<E: Debug> Debug for DoOverError<E>
Source§impl<E> Display for DoOverError<E>where
E: Display,
impl<E> Display for DoOverError<E>where
E: Display,
Source§impl<E> Error for DoOverError<E>
impl<E> Error for DoOverError<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl<E> Policy<DoOverError<E>> for Bulkhead
impl<E> Policy<DoOverError<E>> for Bulkhead
Source§impl<E> Policy<DoOverError<E>> for CircuitBreaker
impl<E> Policy<DoOverError<E>> for CircuitBreaker
Source§impl<E> Policy<DoOverError<E>> for Hedge
impl<E> Policy<DoOverError<E>> for Hedge
Source§impl<E> Policy<DoOverError<E>> for RateLimiter
impl<E> Policy<DoOverError<E>> for RateLimiter
Source§impl<E> Policy<DoOverError<E>> for TimeoutPolicy
impl<E> Policy<DoOverError<E>> for TimeoutPolicy
Auto Trait Implementations§
impl<E> Freeze for DoOverError<E>where
E: Freeze,
impl<E> RefUnwindSafe for DoOverError<E>where
E: RefUnwindSafe,
impl<E> Send for DoOverError<E>where
E: Send,
impl<E> Sync for DoOverError<E>where
E: Sync,
impl<E> Unpin for DoOverError<E>where
E: Unpin,
impl<E> UnwindSafe for DoOverError<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more