rs_clob_client_v2/
errors.rs1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum ClobError {
6 #[error("HTTP request failed: {0}")]
8 HttpError(#[from] reqwest::Error),
9
10 #[error("JSON error: {0}")]
12 JsonError(#[from] serde_json::Error),
13
14 #[error("Signer is needed to interact with this endpoint")]
16 L1AuthUnavailable,
17
18 #[error("API Credentials are needed to interact with this endpoint")]
20 L2AuthNotAvailable,
21
22 #[error("Builder API Credentials needed to interact with this endpoint")]
24 BuilderAuthNotAvailable,
25
26 #[error("Builder key auth failed")]
28 BuilderAuthFailed,
29
30 #[error("Invalid price ({price}), min: {min} - max: {max}")]
32 InvalidPrice { price: f64, min: f64, max: f64 },
33
34 #[error("Invalid tick size ({tick_size}), minimum for the market is {min_tick_size}")]
36 InvalidTickSize {
37 tick_size: String,
38 min_tick_size: String,
39 },
40
41 #[error("No orderbook available")]
43 NoOrderbook,
44
45 #[error("No match found in orderbook")]
47 NoMatch,
48
49 #[error("Ethereum wallet error: {0}")]
51 WalletError(String),
52
53 #[error("EIP-712 signing error: {0}")]
55 SigningError(String),
56
57 #[error("Base64 decode error: {0}")]
59 Base64Error(#[from] base64::DecodeError),
60
61 #[error("Invalid configuration: {0}")]
63 ConfigError(String),
64
65 #[error("API error: {message}")]
67 ApiError { message: String, status: u16 },
68
69 #[error("{0}")]
71 Other(String),
72}
73
74pub type ClobResult<T> = Result<T, ClobError>;