Skip to main content

polymarket_relayer/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum RelayerError {
5    #[error("HTTP error: {0}")]
6    Http(#[from] reqwest::Error),
7
8    #[error("Relayer API error ({status}): {message}")]
9    Api { status: u16, message: String },
10
11    #[error("Signing error: {0}")]
12    Signing(String),
13
14    #[error("ABI encoding error: {0}")]
15    Abi(String),
16
17    #[error("Transaction failed: {0}")]
18    TransactionFailed(String),
19
20    #[error("Transaction invalid: {0}")]
21    TransactionInvalid(String),
22
23    #[error("Timeout waiting for transaction confirmation")]
24    Timeout,
25
26    #[error("Wallet not deployed: {0}")]
27    WalletNotDeployed(String),
28
29    #[error("Wallet already deployed: {0}")]
30    WalletAlreadyDeployed(String),
31
32    #[error("Invalid address: {0}")]
33    InvalidAddress(String),
34
35    #[error("Invalid hex: {0}")]
36    InvalidHex(#[from] hex::FromHexError),
37
38    #[error("Auth error: {0}")]
39    AuthError(String),
40
41    #[error("Relayer quota exhausted (429)")]
42    QuotaExhausted,
43
44    #[error("{0}")]
45    Other(String),
46}
47
48pub type Result<T> = std::result::Result<T, RelayerError>;