1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Error types for do_over policies.
//!
//! This module provides the [`DoOverError`] enum which wraps application errors
//! with policy-specific failure variants.
use 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),
/// }
/// }
/// ```