#[non_exhaustive]
pub enum PgOperationError {
InvalidDeadline,
Deadline,
Acquire(super::Error),
Query(super::Error),
}
impl PgOperationError {
pub fn native(&self) -> Option<&super::Error> {
match self {
Self::Acquire(error) | Self::Query(error) => Some(error),
_ => None,
}
}
}
impl std::fmt::Debug for PgOperationError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self, f)
}
}
impl std::fmt::Display for PgOperationError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
Self::InvalidDeadline => "PostgreSQL operation deadline exceeds 24 hours",
Self::Deadline => "PostgreSQL operation deadline expired",
Self::Acquire(_) => "PostgreSQL operation acquisition failed",
Self::Query(_) => "PostgreSQL operation query failed",
})
}
}
impl std::error::Error for PgOperationError {}