pub enum ClassifiedError<'a, E> {
None(&'a E),
Transient(&'a E),
Permanent(&'a E),
}Expand description
Used to classify errors and API response statuses as None, Transient or
Permanent.
This classification will, in turn, be used to decide whether the request should be re-tried using the backon crate or not.
Variants§
None(&'a E)
The passed type did not represent an error of any kind. Success responses should not be retried.
Transient(&'a E)
A potentially temporary error, such as a network glitch causing a connection issue. These errors are often suitable for retrying the request.
Permanent(&'a E)
A likely permanent error, such as a request with invalid data. Retrying these errors are ineffective since the outcome shouldn’t change.
Implementations§
Source§impl<E> ClassifiedError<'_, E>
impl<E> ClassifiedError<'_, E>
Sourcepub const fn is_none(&self) -> bool
pub const fn is_none(&self) -> bool
Returns whether the error has been classified as None.
This is used for types that may, or may not, represent an error
condition. In the event that the type represents a success or Ok
state, ClassifiedError::None can be used.
§Notes
ClassifiedErroris used to determine whether an API request should be retried or not. Ifis_noneistrue, everything is good and the API call should not be retried.
Sourcepub const fn is_transient(&self) -> bool
pub const fn is_transient(&self) -> bool
Returns whether the error has been classified as Transient.
A transient error is a potentially temporary error, such as a network glitch causing a connection issue. These errors are often suitable for retrying the request.
§Notes
ClassifiedErroris used to determine whether an API request should be retried or not. Ifis_transientistrue, the error result might change on subsequent API calls. A retry is worth a shot.
Sourcepub const fn is_permanent(&self) -> bool
pub const fn is_permanent(&self) -> bool
Returns whether the error has been classified as Permanent.
A likely permanent error, such as a request with invalid data. Retrying these errors are ineffective since the outcome shouldn’t change.
§Notes
ClassifiedErroris used to determine whether an API request should be retried or not. Ifis_permanentistrue, the error result is not expected to change on subsequent API calls. The API call should not be retried.