pub struct EffectFailure { /* private fields */ }Expand description
A failed action, classified so the runtime knows whether it applied.
// The connection was refused: nothing reached the remote system.
let failure = EffectFailure::ambiguous("connection refused").request_sent(false);Implementations§
Source§impl EffectFailure
impl EffectFailure
Sourcepub fn new(
class: FailureClass,
source: impl Into<Box<dyn Error + Send + Sync>>,
) -> Self
pub fn new( class: FailureClass, source: impl Into<Box<dyn Error + Send + Sync>>, ) -> Self
A failure of class class.
Sourcepub fn transient(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
pub fn transient(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
The request did not apply and may succeed if repeated.
Sourcepub fn permanent(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
pub fn permanent(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
The request did not apply and will not succeed if repeated.
Sourcepub fn ambiguous(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
pub fn ambiguous(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
The request may or may not have applied, e.g. a timeout after sending.
Sourcepub fn rate_limited(
retry_after: Option<Duration>,
source: impl Into<Box<dyn Error + Send + Sync>>,
) -> Self
pub fn rate_limited( retry_after: Option<Duration>, source: impl Into<Box<dyn Error + Send + Sync>>, ) -> Self
The remote system asked the caller to slow down.
Sourcepub fn authentication(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
pub fn authentication(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
The credentials were missing or invalid.
The credentials were not allowed to perform the action.
Sourcepub fn validation(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
pub fn validation(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self
The remote system rejected the request as malformed.
Sourcepub fn request_sent(self, sent: bool) -> Self
pub fn request_sent(self, sent: bool) -> Self
Records whether the request reached the remote system. false turns
an ambiguous failure into a transient one: nothing can have applied.
Sourcepub fn class(&self) -> FailureClass
pub fn class(&self) -> FailureClass
The classification after taking Self::request_sent into account.
Trait Implementations§
Source§impl Debug for EffectFailure
impl Debug for EffectFailure
Source§impl Display for EffectFailure
impl Display for EffectFailure
Source§impl Error for EffectFailure
impl Error for EffectFailure
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for EffectFailure
impl !UnwindSafe for EffectFailure
impl Freeze for EffectFailure
impl Send for EffectFailure
impl Sync for EffectFailure
impl Unpin for EffectFailure
impl UnsafeUnpin for EffectFailure
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
Mutably borrows from an owned value. Read more