Skip to main content

fast_cache/
error.rs

1use std::io;
2
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum FastCacheError {
7    #[error("io error: {0}")]
8    Io(#[from] io::Error),
9
10    #[error("toml decode error: {0}")]
11    TomlDecode(#[from] toml::de::Error),
12
13    #[error("toml encode error: {0}")]
14    TomlEncode(#[from] toml::ser::Error),
15
16    #[error("protocol error: {0}")]
17    Protocol(String),
18
19    #[error("command error: {0}")]
20    Command(String),
21
22    #[error("config error: {0}")]
23    Config(String),
24
25    #[error("persistence error: {0}")]
26    Persistence(String),
27
28    #[error("channel closed: {0}")]
29    ChannelClosed(&'static str),
30
31    #[error("task join error: {0}")]
32    TaskJoin(String),
33}
34
35pub type Result<T> = std::result::Result<T, FastCacheError>;