Skip to main content

crw_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum CrwError {
5    #[error("HTTP request failed: {0}")]
6    HttpError(String),
7
8    #[error("URL parse error: {0}")]
9    UrlParseError(#[from] url::ParseError),
10
11    #[error("Invalid request: {0}")]
12    InvalidRequest(String),
13
14    #[error("Renderer error: {0}")]
15    RendererError(String),
16
17    #[error("Extraction error: {0}")]
18    ExtractionError(String),
19
20    #[error("Crawl error: {0}")]
21    CrawlError(String),
22
23    #[error("Timeout after {0}ms")]
24    Timeout(u64),
25
26    #[error("Config error: {0}")]
27    ConfigError(String),
28
29    #[error("Not found: {0}")]
30    NotFound(String),
31
32    #[error("{0}")]
33    Internal(String),
34}
35
36pub type CrwResult<T> = Result<T, CrwError>;