use alloc::string::String;
#[derive(Debug, Clone, PartialEq)]
pub enum QueryExecutionError {
TableNotFound,
FieldNotFound,
TypeMismatch,
InvalidCondition,
OutOfMemory,
ConstraintsConflicts,
InternalError,
NotAllowed,
UnsupportedFunction(String),
InvalidValue,
DatabaseExists,
ResourceLimitExceeded(String),
}
impl core::fmt::Display for QueryExecutionError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
QueryExecutionError::TableNotFound => write!(f, "Table not found"),
QueryExecutionError::FieldNotFound => write!(f, "Field not found"),
QueryExecutionError::TypeMismatch => write!(f, "Type mismatch"),
QueryExecutionError::InvalidCondition => write!(f, "Invalid condition"),
QueryExecutionError::OutOfMemory => write!(f, "Out of memory"),
QueryExecutionError::ConstraintsConflicts => write!(f, "Constraints conflicts"),
QueryExecutionError::InternalError => write!(f, "Internal error"),
QueryExecutionError::NotAllowed => write!(f, "Operation not allowed"),
QueryExecutionError::UnsupportedFunction(func) => {
write!(f, "Unsupported function: {}", func)
}
QueryExecutionError::InvalidValue => {
write!(f, "Invalid value")
}
QueryExecutionError::DatabaseExists => {
write!(f, "Database exists")
}
QueryExecutionError::ResourceLimitExceeded(msg) => {
write!(f, "Resource limit exceeded: {}", msg)
}
}
}
}
impl core::error::Error for QueryExecutionError {}