use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug)]
pub enum Error {
#[error("GPU initialization failed: {0}\nFalling back to SIMD backend")]
GpuInitFailed(String),
#[error(
"VRAM exhausted: {0}\nMorsel-based paging failed to prevent OOM. Please report this issue."
)]
VramExhausted(String),
#[error("Backend equivalence failed: GPU result != SIMD result\nGPU: {gpu_result}\nSIMD: {simd_result}")]
BackendMismatch {
gpu_result: String,
simd_result: String,
},
#[error("SQL parse error: {0}")]
ParseError(String),
#[error("Storage error: {0}")]
StorageError(String),
#[error("GPU transfer queue closed (receiver dropped)")]
QueueClosed,
#[error("Invalid input: {0}")]
InvalidInput(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Arrow error: {0}")]
Arrow(#[from] arrow::error::ArrowError),
#[error("{0}")]
Other(String),
}
impl From<batuta_common::compression::CompressionError> for Error {
fn from(e: batuta_common::compression::CompressionError) -> Self {
Self::StorageError(e.to_string())
}
}