1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#[derive(Debug)]
pub enum Error {
    TagNotExist,
    BothSegmentsNotReady,
    ServiceNotReady,
    #[cfg(feature = "mysql")]
    MySqlError(mysql_async::error::Error),
    #[cfg(feature = "redis")]
    RedisError(redis_async::error::Error),
}

#[cfg(feature = "mysql")]
impl From<mysql_async::error::Error> for Error {
    fn from(err: mysql_async::error::Error) -> Self {
        Self::MySqlError(err)
    }
}

#[cfg(feature = "redis")]
impl From<redis_async::error::Error> for Error {
    fn from(err: redis_async::error::Error) -> Self {
        Self::RedisError(err)
    }
}