Skip to main content

exchange_connectors/
errors.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum ConnectorError {
5    #[error("HTTP error: {0}")]
6    Http(#[from] reqwest::Error),
7
8    #[error("WebSocket error: {0}")]
9    Ws(#[from] tokio_tungstenite::tungstenite::Error),
10
11    #[error("Binance error: {0}")]
12    Binance(#[from] binance::errors::Error),
13
14    #[error("Serde error: {0}")]
15    Serde(#[from] serde_json::Error),
16
17    #[error("Join error: {0}")]
18    Join(#[from] tokio::task::JoinError),
19
20    #[error("Other: {0}")]
21    Other(String),
22}
23
24// Display is derived via `thiserror::Error` using the #[error(..)] attributes above.