pub enum Error<E> {
Permanent(E),
Transient {
err: E,
retry_after: Option<Duration>,
},
}
Expand description
Error is the error value in an operation’s result.
Based on the two possible values, the operation may be retried.
Variants§
Permanent(E)
Permanent means that it’s impossible to execute the operation
successfully. This error is immediately returned from retry()
.
Transient
Transient means that the error is temporary. If the retry_after
is None
the operation should be retried according to the backoff policy, else after
the specified duration. Useful for handling ratelimits like a HTTP 429 response.
Implementations§
Trait Implementations§
Source§impl<E> Error for Error<E>where
E: Error,
impl<E> Error for Error<E>where
E: Error,
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
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
Source§impl<E> From<E> for Error<E>
By default all errors are transient. Permanent errors can
be constructed explicitly. This implementation is for making
the question mark operator (?) and the try!
macro to work.
impl<E> From<E> for Error<E>
By default all errors are transient. Permanent errors can
be constructed explicitly. This implementation is for making
the question mark operator (?) and the try!
macro to work.
Auto Trait Implementations§
impl<E> Freeze for Error<E>where
E: Freeze,
impl<E> RefUnwindSafe for Error<E>where
E: RefUnwindSafe,
impl<E> Send for Error<E>where
E: Send,
impl<E> Sync for Error<E>where
E: Sync,
impl<E> Unpin for Error<E>where
E: Unpin,
impl<E> UnwindSafe for Error<E>where
E: UnwindSafe,
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