zecscope_scanner/
error.rs

1//! Error types for the scanner.
2
3use thiserror::Error;
4
5/// Result type alias for scanner operations.
6pub type ScanResult<T> = Result<T, ScanError>;
7
8/// Errors that can occur during scanning.
9#[derive(Error, Debug)]
10pub enum ScanError {
11    /// Failed to decode the viewing key.
12    #[error("Invalid viewing key: {0}")]
13    InvalidViewingKey(String),
14
15    /// Failed to parse compact block data.
16    #[error("Invalid compact block at height {height}: {message}")]
17    InvalidCompactBlock { height: u64, message: String },
18
19    /// Failed to decode hex string.
20    #[error("Invalid hex in {field}: {message}")]
21    InvalidHex { field: String, message: String },
22
23    /// Error during block scanning.
24    #[error("Scan error at height {height}: {message}")]
25    ScanFailed { height: u32, message: String },
26
27    /// JSON serialization/deserialization error.
28    #[error("JSON error: {0}")]
29    Json(#[from] serde_json::Error),
30}