1use thiserror::Error as ThisError;
2
3#[derive(ThisError, Debug)]
4pub enum Error {
5 #[error("storage error: {0}")]
6 Storage(#[from] rusqlite::Error),
7
8 #[error("not found: {0}")]
9 NotFound(String),
10
11 #[error("already exists: {0}")]
12 AlreadyExists(String),
13
14 #[error("invalid input: {0}")]
15 InvalidInput(String),
16
17 #[error("serialization error: {0}")]
18 Serialization(#[from] serde_json::Error),
19
20 #[error("io error: {0}")]
21 Io(#[from] std::io::Error),
22}
23
24pub type Result<T> = std::result::Result<T, Error>;