market_data/
errors.rs

1use thiserror::Error;
2
3pub type MarketResult<T> = std::result::Result<T, MarketError>;
4
5/// The error enum for MarketData
6#[derive(Debug, Error)]
7pub enum MarketError {
8    #[error("Error parsing the Url: {0}")]
9    UrlParseError(#[from] url::ParseError),
10
11    #[cfg(feature = "use-async")]
12    #[error("Unable to retrieve data: {0}")]
13    RetriveDataError(#[from] reqwest::Error),
14
15    #[cfg(feature = "use-sync")]
16    #[error("Unable to retrieve data: {0}")]
17    RetriveDataError(#[from] std::io::Error),
18
19    #[error("Unable to deserialize: {0}")]
20    UnableToDeserialize(#[from] serde_json::error::Error),
21
22    #[error("Http error: {0}")]
23    HttpError(String),
24
25    #[error("Problem with downloaded data: {0}")]
26    DownloadedData(String),
27
28    #[error("Parsing error: {0}")]
29    ParsingError(String),
30
31    #[error("Unable to write to: {0}")]
32    ToWriter(String),
33
34    #[error("Unsuported Interval for selected publisher: {0}")]
35    UnsuportedInterval(String),
36}