pub struct ClassifiedError {
pub class: Class,
pub source: Box<dyn Error + Send + Sync + 'static>,
/* private fields */
}Expand description
An error with its class, from any crate: the one error type a venue-neutral caller handles.
Built from any Classify error with ? or .into(), which records the
class, is_fault and retry_after
as the error reported them. It displays as its source does and continues
the source chain from there, so wrapping an error changes nothing an error
reporter prints. The original error stays reachable through source, by
downcasting.
It does not implement Classify itself: that would make the blanket
From overlap From<T> for T. Read the class from the class field.
Fields§
§class: ClassThe error’s class.
source: Box<dyn Error + Send + Sync + 'static>The error that was classified.
Implementations§
Source§impl ClassifiedError
impl ClassifiedError
Sourcepub fn new(
class: Class,
source: impl Into<Box<dyn Error + Send + Sync + 'static>>,
) -> Self
pub fn new( class: Class, source: impl Into<Box<dyn Error + Send + Sync + 'static>>, ) -> Self
Classifies an error that does not implement Classify. It counts as a
fault, and its wait is its class’s.
Sourcepub fn is_fault(&self) -> bool
pub fn is_fault(&self) -> bool
Whether the error is a fault, as Classify::is_fault reported it.
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
The wait the server asked for, as Classify::retry_after reported it.
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
Whether retrying could plausibly succeed (see Class::is_retriable).
Trait Implementations§
Source§impl Debug for ClassifiedError
impl Debug for ClassifiedError
Source§impl Display for ClassifiedError
impl Display for ClassifiedError
Source§impl Error for ClassifiedError
impl Error for ClassifiedError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()