pub enum RetryError<E> {
Permanent(E),
Transient {
err: E,
retry_after: Option<Duration>,
},
}
Expand description
Error
is the error value in an actions’s retry 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 an early return from the retry operation.
Transient
Transient
means that the error is temporary. If the retry_after
is None
the operation should be retried according to the defined strategy policy, else after
the specified duration. Useful for handling ratelimits like a HTTP 429 response.
Implementations§
source§impl<E> Error<E>
impl<E> Error<E>
pub fn permanent(err: E) -> Self
pub fn to_permanent<T>(err: E) -> Result<T, Self>
pub fn transient(err: E) -> Self
pub fn to_transient<T>(err: E) -> Result<T, Self>
sourcepub fn to_retry_after<T>(err: E, duration: Duration) -> Result<T, Self>
pub fn to_retry_after<T>(err: E, duration: Duration) -> Result<T, Self>
Creates a Result::Err container with a transient error which is retried after the specified duration. Useful for handling ratelimits like a HTTP 429 response.
sourcepub fn retry_after(err: E, duration: Duration) -> Self
pub fn retry_after(err: E, duration: Duration) -> Self
Creates a transient error which is retried after the specified duration. Useful for handling ratelimits like a HTTP 429 response.
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
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
source§impl<E> From<E> for Error<E>
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.