#[non_exhaustive]pub enum Error {
InvalidUrl {
url: String,
reason: String,
},
Timeout {
url: String,
timeout: Duration,
},
AddressNotAllowed {
host: String,
},
Engine {
url: Option<String>,
source: Box<dyn StdError + Send + Sync + 'static>,
},
JavaScript {
url: Option<String>,
source: Box<dyn StdError + Send + Sync + 'static>,
},
Screenshot {
url: Option<String>,
source: Box<dyn StdError + Send + Sync + 'static>,
},
Extract(ExtractError),
Cookies {
path: String,
reason: String,
},
Schema(SchemaError),
Io(Error),
InvalidGlob(Error),
InvalidHeader(String),
}Expand description
Errors from servo-fetch operations.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidUrl
The URL is malformed or uses a disallowed scheme.
Timeout
The page did not finish loading within the configured timeout.
AddressNotAllowed
The URL resolves to a private or reserved address (SSRF protection).
Engine
The Servo engine is unavailable or crashed.
Fields
JavaScript
JavaScript evaluation failed.
Fields
Screenshot
Screenshot capture failed.
Fields
Extract(ExtractError)
Content extraction failed.
Cookies
Failed to load or parse a cookies file.
Schema(SchemaError)
Schema-based structured extraction failed.
Io(Error)
An I/O error occurred.
InvalidGlob(Error)
A glob pattern is invalid.
InvalidHeader(String)
A custom request header is malformed or not permitted.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns true if this is a timeout error.
Sourcepub fn is_network(&self) -> bool
pub fn is_network(&self) -> bool
Returns true if this is a network-related error (timeout or address-policy rejection).
Sourcepub fn host(&self) -> Option<&str>
pub fn host(&self) -> Option<&str>
Returns the host that was rejected, if this is Error::AddressNotAllowed.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<ExtractError> for Error
impl From<ExtractError> for Error
Source§fn from(source: ExtractError) -> Self
fn from(source: ExtractError) -> Self
Source§impl From<SchemaError> for Error
impl From<SchemaError> for Error
Source§fn from(source: SchemaError) -> Self
fn from(source: SchemaError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
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