Skip to main content

magic_bird/
error.rs

1//! Error types for BIRD operations.
2
3use std::path::PathBuf;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7    #[error("IO error: {0}")]
8    Io(#[from] std::io::Error),
9
10    #[error("DuckDB error: {0}")]
11    DuckDb(#[from] duckdb::Error),
12
13    #[error("JSON error: {0}")]
14    Json(#[from] serde_json::Error),
15
16    #[error("Configuration error: {0}")]
17    Config(String),
18
19    #[error("Storage error: {0}")]
20    Storage(String),
21
22    #[error("BIRD not initialized at {0}")]
23    NotInitialized(PathBuf),
24
25    #[error("BIRD already initialized at {0}")]
26    AlreadyInitialized(PathBuf),
27
28    #[error("Invalid path: {0}")]
29    InvalidPath(String),
30
31    #[error("Not found: {0}")]
32    NotFound(String),
33
34    #[error("Extension error: {0}")]
35    Extension(String),
36}
37
38pub type Result<T> = std::result::Result<T, Error>;