#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ErrorClass {
Transient,
Conflict,
PreconditionFailed,
Permanent,
}
impl ErrorClass {
#[inline]
pub const fn as_str(&self) -> &'static str {
match self {
Self::Transient => "transient",
Self::Conflict => "conflict",
Self::PreconditionFailed => "precondition_failed",
Self::Permanent => "permanent",
}
}
#[inline]
pub const fn is_retryable(&self) -> bool {
matches!(self, Self::Transient | Self::Conflict)
}
#[inline]
pub const fn is_permanent(&self) -> bool {
matches!(self, Self::Permanent)
}
}