sova_redis/error.rs
1use sova_core::Error;
2
3#[derive(Debug, thiserror::Error)]
4#[error("{0}")]
5pub struct RedisError(pub String);
6
7impl RedisError {
8 pub fn msg(s: impl Into<String>) -> Self {
9 Self(s.into())
10 }
11}
12
13impl From<redis::RedisError> for RedisError {
14 fn from(err: redis::RedisError) -> Self {
15 Self(err.to_string())
16 }
17}
18
19impl From<RedisError> for Error {
20 fn from(err: RedisError) -> Self {
21 Error::Internal(err.0)
22 }
23}