pub enum FailureClass {
Transient,
Permanent,
Ambiguous,
RateLimited {
retry_after: Option<Duration>,
},
Authentication,
Authorization,
Validation,
}Expand description
What kind of failure an action reported.
The classification, not the mere presence of an error, decides whether the runtime retries, fails or treats the outcome as unknown.
Variants§
Transient
The request did not take effect and may succeed if repeated, e.g. a connection refused before anything was sent.
Permanent
The request did not take effect and will not succeed if repeated.
Ambiguous
The request may or may not have taken effect, e.g. a timeout after the request was sent.
RateLimited
The remote system asked the caller to slow down.
Fields
Authentication
The credentials were missing or invalid.
Authorization
The credentials were valid but not allowed to perform the action.
Validation
The remote system rejected the request as malformed.
Implementations§
Source§impl FailureClass
impl FailureClass
Sourcepub const fn disposition(self) -> Disposition
pub const fn disposition(self) -> Disposition
How the runtime treats this failure.
Sourcepub const fn retry_after(self) -> Option<Duration>
pub const fn retry_after(self) -> Option<Duration>
The minimum delay the remote system asked for, if any.
Sourcepub const fn with_request_sent(self, request_sent: Option<bool>) -> FailureClass
pub const fn with_request_sent(self, request_sent: Option<bool>) -> FailureClass
Refines a classification with whether the request reached the remote system.
Knowing the request was never sent (Some(false), e.g. a refused
connection or a DNS failure) turns Self::Ambiguous into
Self::Transient, because nothing can have been applied. Nothing
else changes: a sent request that got a definitive answer, such as a
503, is still whatever its class says.
Trait Implementations§
Source§impl Clone for FailureClass
impl Clone for FailureClass
Source§fn clone(&self) -> FailureClass
fn clone(&self) -> FailureClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more