Skip to main content

simple_waf_scanner/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur during WAF scanning operations
4#[derive(Error, Debug)]
5pub enum ScanError {
6    /// HTTP request failed
7    #[error("HTTP request failed: {0}")]
8    HttpError(#[from] reqwest::Error),
9
10    /// Failed to parse JSON data
11    #[error("Failed to parse JSON: {0}")]
12    ParseError(#[from] serde_json::Error),
13
14    /// Invalid configuration
15    #[error("Invalid configuration: {0}")]
16    ConfigError(String),
17
18    /// IO operation failed
19    #[error("IO error: {0}")]
20    IoError(#[from] std::io::Error),
21
22    /// Invalid payload format
23    #[error("Invalid payload format: {0}")]
24    InvalidPayload(String),
25
26    /// No payloads loaded
27    #[error("No payloads available for scanning")]
28    NoPayloads,
29
30    /// URL parsing error
31    #[error("Invalid URL: {0}")]
32    UrlError(String),
33}
34
35/// Result type for scanner operations
36pub type Result<T> = std::result::Result<T, ScanError>;