use thiserror::Error;
#[derive(Debug, Error)]
pub enum DrizzleError {
#[error("Execution error: {0}")]
ExecutionError(compact_str::CompactString),
#[error("Prepare error: {0}")]
PrepareError(compact_str::CompactString),
#[error("No rows found")]
NotFound,
#[error("Transaction error: {0}")]
TransactionError(compact_str::CompactString),
#[error("Mapping error: {0}")]
Mapping(compact_str::CompactString),
#[error("Statement error: {0}")]
Statement(compact_str::CompactString),
#[error("Query error: {0}")]
Query(compact_str::CompactString),
#[error("Parameter conversion error: {0}")]
ParameterError(compact_str::CompactString),
#[error("Integer conversion error: {0}")]
TryFromInt(#[from] core::num::TryFromIntError),
#[error("Parse int error: {0}")]
ParseInt(#[from] core::num::ParseIntError),
#[error("Parse float error: {0}")]
ParseFloat(#[from] core::num::ParseFloatError),
#[error("Parse bool error: {0}")]
ParseBool(#[from] core::str::ParseBoolError),
#[error("Type conversion error: {0}")]
ConversionError(compact_str::CompactString),
#[error("Database error: {0}")]
Other(compact_str::CompactString),
#[cfg(feature = "rusqlite")]
#[error("Rusqlite error: {0}")]
Rusqlite(#[from] rusqlite::Error),
#[cfg(feature = "turso")]
#[error("Turso error: {0}")]
Turso(#[from] turso::Error),
#[cfg(feature = "libsql")]
#[error("LibSQL error: {0}")]
LibSQL(#[from] libsql::Error),
#[cfg(feature = "tokio-postgres")]
#[error("Postgres error: {0}")]
Postgres(#[from] tokio_postgres::Error),
#[cfg(all(feature = "postgres-sync", not(feature = "tokio-postgres")))]
#[error("Postgres error: {0}")]
Postgres(#[from] postgres::Error),
#[cfg(feature = "uuid")]
#[error("UUID error: {0}")]
UuidError(#[from] uuid::Error),
#[cfg(feature = "serde")]
#[error("JSON error: {0}")]
JsonError(#[from] serde_json::Error),
#[error("Infallible conversion error")]
Infallible(#[from] core::convert::Infallible),
}
pub type Result<T> = core::result::Result<T, DrizzleError>;