Skip to main content

sandbox_quant/error/
exchange_error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error, Clone, PartialEq, Eq)]
4pub enum ExchangeError {
5    #[error("network timeout")]
6    NetworkTimeout,
7    #[error("rate limited: status={status} code={code:?} endpoint={endpoint} message={message}")]
8    RateLimited {
9        status: u16,
10        code: Option<i64>,
11        endpoint: String,
12        message: String,
13    },
14    #[error("authentication failed: status={status} code={code:?} endpoint={endpoint} message={message}")]
15    AuthenticationFailed {
16        status: u16,
17        code: Option<i64>,
18        endpoint: String,
19        message: String,
20    },
21    #[error("missing configuration: {0}")]
22    MissingConfiguration(&'static str),
23    #[error("invalid timestamp")]
24    InvalidTimestamp,
25    #[error("invalid response")]
26    InvalidResponse,
27    #[error("remote rejected request: code={code} message={message}")]
28    RemoteReject { code: i64, message: String },
29    #[error("transport failure")]
30    TransportFailure,
31    #[error("unsupported market operation")]
32    UnsupportedMarketOperation,
33}