hitbox_redis/
error.rs

1//! Error decplaration and transformation into [BackendError].
2//!
3//! [BackendError]: hitbox_backend::BackendError
4use hitbox_backend::BackendError;
5use redis::RedisError;
6
7/// Redis backend error declaration.
8///
9/// Simply, it's just a wrapper for [redis::RedisError].
10///
11/// [redis::RedisError]: redis::RedisError
12#[derive(Debug, thiserror::Error)]
13pub enum Error {
14    /// Wrapper for all kinds redis-rs errors.
15    #[error("Redis backend error: {0}")]
16    Redis(RedisError),
17}
18
19impl From<RedisError> for Error {
20    fn from(error: RedisError) -> Self {
21        Error::Redis(error)
22    }
23}
24
25impl From<Error> for BackendError {
26    fn from(error: Error) -> Self {
27        Self::InternalError(Box::new(error))
28    }
29}