#[non_exhaustive]pub enum FetcherError {
ExhaustedRetries {
attempts: u32,
source: Error,
},
TooLarge {
limit_bytes: usize,
advertised_bytes: Option<u64>,
},
BodyRead(Error),
Http(Error),
}Expand description
Errors from building a Fetcher or performing a request.
Variants are typed (rather than stringified) so callers can build retry
policies: a timeout or connect failure is worth retrying, a body-size
violation is not. Marked #[non_exhaustive] so future variants are not
a breaking change — match with a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ExhaustedRetries
Every send attempt failed at the transport level (DNS, connect,
TLS, timeout, …). source is the LAST attempt’s error; classify it
with FetcherError::is_timeout / FetcherError::is_connect or
inspect the reqwest::Error directly.
Fields
TooLarge
The response body exceeded the configured size cap
(FetcherConfig::max_body_bytes). Not retried — the same URL will
exceed the cap again.
Fields
BodyRead(Error)
A body chunk could not be read after the response headers arrived.
Http(Error)
The underlying reqwest client failed to build (e.g. TLS backend initialization).
Implementations§
Source§impl FetcherError
impl FetcherError
Sourcepub fn transport_error(&self) -> Option<&Error>
pub fn transport_error(&self) -> Option<&Error>
The underlying transport error, when this error wraps one.
FetcherError::Http is excluded: it reports a client-BUILD
failure (e.g. TLS backend init), not something that happened on
the wire.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Whether the underlying failure was a timeout (worth retrying).
Sourcepub fn is_connect(&self) -> bool
pub fn is_connect(&self) -> bool
Whether the underlying failure was a connection failure (DNS, refused, unreachable — often worth retrying or rotating a proxy).
Trait Implementations§
Source§impl Debug for FetcherError
impl Debug for FetcherError
Source§impl Display for FetcherError
impl Display for FetcherError
Source§impl Error for FetcherError
impl Error for FetcherError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for FetcherError
impl From<Error> for FetcherError
Source§impl From<FetcherError> for SessionError
impl From<FetcherError> for SessionError
Source§fn from(source: FetcherError) -> Self
fn from(source: FetcherError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for FetcherError
impl !UnwindSafe for FetcherError
impl Freeze for FetcherError
impl Send for FetcherError
impl Sync for FetcherError
impl Unpin for FetcherError
impl UnsafeUnpin for FetcherError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.