Skip to main content

Module error

Module error 

Source
Expand description

Custom error types for the spider framework.

This module defines comprehensive error types used throughout the spider ecosystem:

  • SpiderError: The main error type for the spider framework, covering network failures, URL parsing problems, I/O errors, configuration issues, and pipeline errors.
  • PipelineError: Specialized errors for item processing pipelines.
  • ReqwestError: A simplified wrapper around reqwest errors with additional context about connection and timeout issues.

By centralizing error definitions, the module provides a consistent and semantic way to report and handle errors, improving the robustness and maintainability of web scraping applications.

§Example

use spider_util::error::{SpiderError, PipelineError};
use url::Url;

// URL parsing error
let result: Result<Url, SpiderError> = Url::parse("not-a-url");
if let Err(e) = result {
    println!("Error: {}", e);
}

// Pipeline error
let pipeline_err = PipelineError::IoError("File not found".to_string());

Structs§

ReqwestError
A wrapper around reqwest errors with additional context.

Enums§

PipelineError
Error type for item processing pipelines.
SpiderError
The main error type for the spider framework.