pub enum SpiderError {
Show 15 variants
ReqwestError(ReqwestError),
UrlParseError(ParseError),
JsonError(String),
IoError(String),
ConfigurationError(String),
GeneralError(String),
ItemToStringError(String),
ItemSerializationError(String),
Unknown,
InvalidHeaderValue(String),
HeaderValueError(String),
HtmlParseError(String),
Utf8Error(Utf8Error),
PipelineError(PipelineError),
BlockedByRobotsTxt,
}Expand description
The main error type for the spider framework.
SpiderError encompasses all possible errors that can occur during
web scraping operations, from network failures to data processing issues.
§Variants
- Network Errors:
ReqwestErrorfor HTTP client errors - URL Errors:
UrlParseErrorfor invalid URLs - Serialization Errors:
JsonErrorfor JSON parsing/serialization - I/O Errors:
IoErrorfor file system operations - Configuration Errors:
ConfigurationErrorfor invalid settings - Pipeline Errors:
PipelineErrorfor item processing failures - HTML/UTF-8 Errors: Parse errors for HTML and UTF-8 content
- Robots.txt:
BlockedByRobotsTxtfor blocked requests
§Example
use spider_util::error::SpiderError;
use url::Url;
// Handle different error types
match Url::parse("not-a-url") {
Ok(url) => println!("Valid URL: {}", url),
Err(SpiderError::UrlParseError(e)) => println!("Invalid URL: {}", e),
Err(e) => println!("Other error: {}", e),
}Variants§
ReqwestError(ReqwestError)
HTTP client error.
UrlParseError(ParseError)
URL parsing error.
JsonError(String)
JSON parsing or serialization error.
IoError(String)
I/O operation error.
ConfigurationError(String)
Invalid configuration error.
GeneralError(String)
General unspecified error.
ItemToStringError(String)
Failed to convert item to string.
ItemSerializationError(String)
Item serialization error.
Unknown
Unknown error.
InvalidHeaderValue(String)
Invalid HTTP header value.
HeaderValueError(String)
HTTP header value error.
HtmlParseError(String)
HTML parsing error.
Utf8Error(Utf8Error)
UTF-8 decoding error.
PipelineError(PipelineError)
Pipeline processing error.
BlockedByRobotsTxt
Request blocked by robots.txt.
Trait Implementations§
Source§impl Clone for SpiderError
impl Clone for SpiderError
Source§fn clone(&self) -> SpiderError
fn clone(&self) -> SpiderError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpiderError
impl Debug for SpiderError
Source§impl Display for SpiderError
impl Display for SpiderError
Source§impl Error for SpiderError
impl Error for SpiderError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for SpiderError
impl From<Error> for SpiderError
Source§fn from(err: Error) -> SpiderError
fn from(err: Error) -> SpiderError
Converts to this type from the input type.
Source§impl From<Error> for SpiderError
impl From<Error> for SpiderError
Source§fn from(err: Error) -> SpiderError
fn from(err: Error) -> SpiderError
Converts to this type from the input type.
Source§impl From<Error> for SpiderError
impl From<Error> for SpiderError
Source§fn from(err: Error) -> SpiderError
fn from(err: Error) -> SpiderError
Converts to this type from the input type.
Source§impl From<Error> for SpiderError
impl From<Error> for SpiderError
Source§fn from(err: Error) -> SpiderError
fn from(err: Error) -> SpiderError
Converts to this type from the input type.
Source§impl From<InvalidHeaderValue> for SpiderError
impl From<InvalidHeaderValue> for SpiderError
Source§fn from(err: InvalidHeaderValue) -> SpiderError
fn from(err: InvalidHeaderValue) -> SpiderError
Converts to this type from the input type.
Source§impl From<ParseError> for SpiderError
impl From<ParseError> for SpiderError
Source§fn from(source: ParseError) -> SpiderError
fn from(source: ParseError) -> SpiderError
Converts to this type from the input type.
Source§impl From<PipelineError> for SpiderError
impl From<PipelineError> for SpiderError
Source§fn from(source: PipelineError) -> SpiderError
fn from(source: PipelineError) -> SpiderError
Converts to this type from the input type.
Source§impl From<ReqwestError> for SpiderError
impl From<ReqwestError> for SpiderError
Source§fn from(source: ReqwestError) -> SpiderError
fn from(source: ReqwestError) -> SpiderError
Converts to this type from the input type.
Source§impl From<Utf8Error> for SpiderError
impl From<Utf8Error> for SpiderError
Source§fn from(source: Utf8Error) -> SpiderError
fn from(source: Utf8Error) -> SpiderError
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SpiderError
impl RefUnwindSafe for SpiderError
impl Send for SpiderError
impl Sync for SpiderError
impl Unpin for SpiderError
impl UnsafeUnpin for SpiderError
impl UnwindSafe for SpiderError
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> Pointable for T
impl<T> Pointable for T
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.