pub enum FetchError {
Request(Error),
Url(ParseError),
Json(Error),
InvalidProxy(String),
SessionNotActive,
SessionAlreadyActive,
MaxRetriesExceeded {
attempts: u32,
last_error: Box<FetchError>,
},
NoRequest,
Other(String),
}Expand description
Errors that can occur during HTTP fetching operations.
This is the single error type for the entire crate. It wraps errors from underlying libraries (wreq, url, serde_json) and adds scrapling-specific variants for proxy, session, and retry failures.
Variants§
Request(Error)
An error from the underlying wreq HTTP client, such as a connection failure,
timeout, or TLS handshake error. Inspect the inner wreq::Error for details.
Url(ParseError)
The URL string could not be parsed. This typically happens when a relative URL is passed where an absolute one is expected, or when the scheme is missing.
Json(Error)
A JSON serialization or deserialization error. This occurs when a
RequestConfig::json body cannot be serialized,
or when response JSON is malformed.
InvalidProxy(String)
The proxy configuration is invalid. The contained string describes what went wrong – for example, a duplicate proxy in a rotator or a malformed proxy URL.
SessionNotActive
A request was attempted on a FetcherSession that
has not been opened yet. Call open() first.
SessionAlreadyActive
open() was called on a session that is
already active. Close the existing session before opening a new one.
MaxRetriesExceeded
All retry attempts have been exhausted without a successful response. The
last_error field contains the error from the final attempt so you can
diagnose the root cause.
Fields
last_error: Box<FetchError>The error from the final attempt.
NoRequest
The response has no associated request metadata. This can happen when a
Response is constructed manually rather than by the fetcher.
Other(String)
A catch-all error with a descriptive message for situations not covered by the other variants (e.g., an invalid HTTP method string).
Trait Implementations§
Source§impl Debug for FetchError
impl Debug for FetchError
Source§impl Display for FetchError
impl Display for FetchError
Source§impl Error for FetchError
impl Error for FetchError
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 FetchError
impl From<Error> for FetchError
Source§impl From<Error> for FetchError
impl From<Error> for FetchError
Source§impl From<ParseError> for FetchError
impl From<ParseError> for FetchError
Source§fn from(e: ParseError) -> Self
fn from(e: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for FetchError
impl !RefUnwindSafe for FetchError
impl Send for FetchError
impl Sync for FetchError
impl Unpin for FetchError
impl UnsafeUnpin for FetchError
impl !UnwindSafe for FetchError
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more