use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SqlTypeError {
NegativeValue,
Overflow,
InvalidFormat(String),
}
impl fmt::Display for SqlTypeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SqlTypeError::NegativeValue => {
write!(f, "cannot convert negative value to unsigned integer")
}
SqlTypeError::Overflow => {
write!(f, "value overflow — exceeds target type range")
}
SqlTypeError::InvalidFormat(msg) => {
write!(f, "invalid format: {msg}")
}
}
}
}
impl std::error::Error for SqlTypeError {}