ubiquity_database/
error.rs1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum DatabaseError {
8 #[error("Connection error: {0}")]
9 Connection(String),
10
11 #[error("Query error: {0}")]
12 Query(String),
13
14 #[error("Schema error: {0}")]
15 Schema(String),
16
17 #[error("Vector dimension mismatch: expected {expected}, got {actual}")]
18 VectorDimensionMismatch { expected: usize, actual: usize },
19
20 #[error("Pool index out of range: {0}")]
21 InvalidPoolIndex(usize),
22
23 #[error("Serialization error: {0}")]
24 Serialization(#[from] serde_json::Error),
25
26 #[error("SQLite error: {0}")]
27 Sqlite(#[from] sqlx::Error),
28
29 #[cfg(feature = "astra")]
30 #[error("Astra DB error: {0}")]
31 Astra(String),
32
33 #[error("Not implemented for this backend")]
34 NotImplemented,
35
36 #[error("Configuration error: {0}")]
37 Configuration(String),
38
39 #[error("IO error: {0}")]
40 Io(#[from] std::io::Error),
41
42 #[error("Other error: {0}")]
43 Other(#[from] anyhow::Error),
44}
45
46pub type DatabaseResult<T> = Result<T, DatabaseError>;