1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum StoreError {
5 #[error("I/O error: {0}")]
6 Io(#[from] std::io::Error),
7
8 #[error("Serialization/deserialization error: {0}")]
9 Serialization(String),
10
11 #[error("Item not found: {0}")]
12 NotFound(String),
13
14 #[error("Database backend error: {0}")]
15 Backend(#[from] Box<dyn std::error::Error + Send + Sync>),
16
17 #[error("Database connection error: {0}")]
18 Connection(String),
19
20 #[error("Database operation error: {0}")]
21 Database(String),
22
23 #[error("Migration error: {0}")]
24 Migration(String),
25
26 #[error("Device with ID {0} not found")]
27 DeviceNotFound(i32),
28}
29
30pub type Result<T> = std::result::Result<T, StoreError>;