Skip to main content

ErrorClassifier

Trait ErrorClassifier 

Source
pub trait ErrorClassifier: Send + Sync {
    // Required methods
    fn is_connection_error(&self, err: &AppError) -> bool;
    fn is_retryable_error(&self, err: &AppError) -> bool;
}
Expand description

Classifies errors for retry and circuit-breaker decisions.

Broker adapters implement this trait so that generic retry policies and circuit breakers can decide how to handle a particular failure without knowing which broker produced it.

Required Methods§

Source

fn is_connection_error(&self, err: &AppError) -> bool

Returns true when the error indicates the broker connection is down (e.g. TCP reset, DNS failure, authentication timeout).

Source

fn is_retryable_error(&self, err: &AppError) -> bool

Returns true when the error is transient and the operation can be retried (e.g. leader election in progress, throttling, temporary I/O error). Connection errors are typically retryable too, but the distinction lets callers apply different back-off strategies.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§