aranet_store/
error.rs

1//! Error types for aranet-store.
2
3use std::path::PathBuf;
4
5/// Result type for aranet-store operations.
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Errors that can occur in aranet-store.
9#[derive(Debug, thiserror::Error)]
10pub enum Error {
11    /// Database error from SQLite.
12    #[error("Database error: {0}")]
13    Database(#[from] rusqlite::Error),
14
15    /// Failed to create database directory.
16    #[error("Failed to create database directory {path}: {source}")]
17    CreateDirectory {
18        path: PathBuf,
19        source: std::io::Error,
20    },
21
22    /// Device not found in database.
23    #[error("Device not found: {0}")]
24    DeviceNotFound(String),
25
26    /// Invalid timestamp.
27    #[error("Invalid timestamp: {0}")]
28    InvalidTimestamp(String),
29
30    /// Serialization error.
31    #[error("Serialization error: {0}")]
32    Serialization(#[from] serde_json::Error),
33
34    /// IO error.
35    #[error("IO error: {0}")]
36    Io(#[from] std::io::Error),
37}