ubiquity-database 0.1.1

Database abstraction layer for Ubiquity supporting SQLite and Astra DB
Documentation
//! Database error types

use thiserror::Error;

/// Database errors
#[derive(Error, Debug)]
pub enum DatabaseError {
    #[error("Connection error: {0}")]
    Connection(String),
    
    #[error("Query error: {0}")]
    Query(String),
    
    #[error("Schema error: {0}")]
    Schema(String),
    
    #[error("Vector dimension mismatch: expected {expected}, got {actual}")]
    VectorDimensionMismatch { expected: usize, actual: usize },
    
    #[error("Pool index out of range: {0}")]
    InvalidPoolIndex(usize),
    
    #[error("Serialization error: {0}")]
    Serialization(#[from] serde_json::Error),
    
    #[error("SQLite error: {0}")]
    Sqlite(#[from] sqlx::Error),
    
    #[cfg(feature = "astra")]
    #[error("Astra DB error: {0}")]
    Astra(String),
    
    #[error("Not implemented for this backend")]
    NotImplemented,
    
    #[error("Configuration error: {0}")]
    Configuration(String),
    
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),
    
    #[error("Other error: {0}")]
    Other(#[from] anyhow::Error),
}

/// Result type for database operations
pub type DatabaseResult<T> = Result<T, DatabaseError>;