web_analyzer/error.rs
1//! Error types for the web-analyzer crate.
2
3/// Errors that can occur during web analysis operations.
4#[derive(Debug, thiserror::Error)]
5pub enum WebAnalyzerError {
6 /// An HTTP request failed.
7 #[error("HTTP request failed: {0}")]
8 Http(#[from] reqwest::Error),
9
10 /// DNS resolution failed for a target domain.
11 #[error("DNS resolution failed for {domain}: {detail}")]
12 Dns {
13 /// The domain that failed to resolve.
14 domain: String,
15 /// Details about the failure.
16 detail: String,
17 },
18
19 /// An external tool (dig, nmap, subfinder, etc.) was not found or failed.
20 #[error("External tool '{tool}' failed: {detail}")]
21 ExternalTool {
22 /// Name of the tool (e.g. "dig", "nmap", "subfinder").
23 tool: String,
24 /// Details about the failure.
25 detail: String,
26 },
27
28 /// An operation timed out.
29 #[error("Timeout: {0}")]
30 Timeout(String),
31
32 /// A parsing error occurred while processing output.
33 #[error("Parse error: {0}")]
34 Parse(String),
35
36 /// JSON serialization/deserialization error.
37 #[error("JSON error: {0}")]
38 Json(#[from] serde_json::Error),
39
40 /// A generic error for uncategorized failures.
41 #[error("{0}")]
42 Other(String),
43}
44
45/// Convenience alias for `Result<T, WebAnalyzerError>`.
46pub type Result<T> = std::result::Result<T, WebAnalyzerError>;