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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Error types for Redis backend operations.
//!
//! This module provides error types specific to the Redis backend. All errors
//! can be converted to [`BackendError`] for uniform error handling across
//! different cache backends.
//!
//! [`BackendError`]: hitbox_backend::BackendError
use BackendError;
use RedisError;
/// Error type for Redis backend operations.
///
/// Wraps errors from the underlying [`redis`] crate. This enum may be extended
/// in the future to distinguish between different error categories (connection,
/// protocol, timeout, etc.).
///
/// # When You'll Encounter This
///
/// You typically don't handle this error directly. It appears when:
///
/// - Using [`RedisBackendBuilder::build`] with an invalid connection URL
/// - Performing the first cache operation when Redis is unreachable
/// (connection is established lazily)
/// - Performing cache operations when the Redis server returns an error
///
/// In most cases, this error is automatically converted to [`BackendError`]
/// and propagated through the cache layer.
///
/// # Examples
///
/// ```no_run
/// use hitbox_redis::{RedisBackend, ConnectionMode};
///
/// # fn main() {
/// // Invalid URL returns Error::Redis
/// let result = RedisBackend::builder()
/// .connection(ConnectionMode::single("not-a-valid-url"))
/// .build();
///
/// match result {
/// Ok(_) => println!("Connected"),
/// Err(e) => println!("Failed: {}", e),
/// }
/// # }
/// ```
///
/// [`RedisBackendBuilder::build`]: crate::RedisBackendBuilder::build
/// [`BackendError`]: hitbox_backend::BackendError