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()