pub enum ErrorClass {
Network,
Timeout,
RateLimit,
ResourceExhaustion,
ParseError,
AuthError,
Unknown,
}Expand description
Classified error category used to select the best default recovery strategy.
Variants§
Network
Network / connection errors — retry with backoff
Timeout
Timeout errors — retry with longer backoff
RateLimit
Rate limiting (HTTP 429) — retry with aggressive backoff
ResourceExhaustion
Resource exhaustion (OOM, disk full) — clear caches then retry
ParseError
Parse / deserialization errors — restart from checkpoint
AuthError
Authentication / permission errors — fallback
Unknown
Unknown — default to retry
Implementations§
Source§impl ErrorClass
impl ErrorClass
Sourcepub fn classify_anyhow(error: &Error) -> Self
pub fn classify_anyhow(error: &Error) -> Self
Classify an anyhow::Error by attempting typed downcasts first,
then falling back to the string-based classify method.
Typed checks are more robust than string matching because they survive refactoring – if an upstream library changes its error messages, the typed downcast still works. String matching is kept as a fallback for errors that cannot be represented by a concrete type.
Sourcepub fn classify(error_type: &str, message: &str) -> Self
pub fn classify(error_type: &str, message: &str) -> Self
Classify an error based on its type and message content.
This is the string-based fallback used when the original typed error is
not available. Prefer classify_anyhow when
you have an anyhow::Error.
Sourcepub fn default_strategy(self) -> RecoveryStrategy
pub fn default_strategy(self) -> RecoveryStrategy
Return the default recovery strategy for this error class.
Sourcepub fn escalation_strategy(self) -> Option<RecoveryStrategy>
pub fn escalation_strategy(self) -> Option<RecoveryStrategy>
Return the escalation strategy to try if the primary strategy fails.
Trait Implementations§
Source§impl Clone for ErrorClass
impl Clone for ErrorClass
Source§fn clone(&self) -> ErrorClass
fn clone(&self) -> ErrorClass
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ErrorClass
impl Debug for ErrorClass
Source§impl<'de> Deserialize<'de> for ErrorClass
impl<'de> Deserialize<'de> for ErrorClass
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ErrorClass
impl PartialEq for ErrorClass
Source§impl Serialize for ErrorClass
impl Serialize for ErrorClass
impl Copy for ErrorClass
impl Eq for ErrorClass
impl StructuralPartialEq for ErrorClass
Auto Trait Implementations§
impl Freeze for ErrorClass
impl RefUnwindSafe for ErrorClass
impl Send for ErrorClass
impl Sync for ErrorClass
impl Unpin for ErrorClass
impl UnsafeUnpin for ErrorClass
impl UnwindSafe for ErrorClass
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request