use crate::common::symbol::Symbol;
#[derive(Debug, Clone, PartialEq)]
pub enum BindError {
DatabaseAlreadyExists(Symbol),
RoleNotFound(Symbol),
TablespaceNotFound(Symbol),
InvalidConnectionLimit(i64),
}
impl std::fmt::Display for BindError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
BindError::DatabaseAlreadyExists(s) => {
write!(f, "database {:?} already exists", s)
}
BindError::RoleNotFound(s) => {
write!(f, "role {:?} does not exist", s)
}
BindError::TablespaceNotFound(s) => {
write!(f, "tablespace {:?} does not exist", s)
}
BindError::InvalidConnectionLimit(n) => {
write!(f, "invalid connection limit {}, must be >= -1", n)
}
}
}
}
impl std::error::Error for BindError {}