wordpress_audit/
error.rs

1//! Error types for wordpress-audit
2
3use thiserror::Error;
4
5/// Result type alias using our Error type
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Errors that can occur during WordPress audit operations
9#[derive(Debug, Error)]
10pub enum Error {
11    /// Invalid URL provided
12    #[error("invalid URL: {0}")]
13    InvalidUrl(String),
14
15    /// Failed to create HTTP client
16    #[error("failed to create HTTP client: {0}")]
17    HttpClient(String),
18
19    /// HTTP request failed
20    #[error("HTTP request failed: {0}")]
21    HttpRequest(String),
22
23    /// HTTP response error status
24    #[error("HTTP error: status {0}")]
25    HttpStatus(u16),
26
27    /// Site does not appear to be WordPress
28    #[error("site does not appear to be WordPress")]
29    NotWordPress,
30
31    /// Invalid output format specified
32    #[error("invalid output format: '{0}' (valid: human, json, none)")]
33    InvalidOutputFormat(String),
34
35    /// Invalid output detail level specified
36    #[error("invalid output detail: '{0}' (valid: all, nok)")]
37    InvalidOutputDetail(String),
38
39    /// Invalid output sort order specified
40    #[error("invalid output sort: '{0}' (valid: status, name)")]
41    InvalidOutputSort(String),
42
43    /// Output operation failed
44    #[error("output failed: {0}")]
45    OutputFailed(#[source] std::io::Error),
46
47    /// JSON serialization failed
48    #[error("JSON serialization failed")]
49    SerializationFailed(#[from] serde_json::Error),
50}