Skip to main content

qamd_rs/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in the QAMD library
4#[derive(Error, Debug)]
5pub enum QAMDError {
6    /// Error during serialization or deserialization
7    #[error("Serialization error: {0}")]
8    SerializationError(#[from] serde_json::Error),
9    
10    /// Error parsing a date or time
11    #[error("Date/time parse error: {0}")]
12    DateTimeParseError(#[from] chrono::ParseError),
13    
14    /// Market data is invalid or missing required fields
15    #[error("Invalid market data: {0}")]
16    InvalidMarketData(String),
17    
18    /// General error
19    #[error("{0}")]
20    General(String),
21}
22
23/// Result type for QAMD operations
24pub type Result<T> = std::result::Result<T, QAMDError>;