Skip to main content

eth_prices/
error.rs

1#[derive(thiserror::Error, Debug)]
2pub enum EthPricesError {
3    #[error("Failed to parse configuration: {0}")]
4    ConfigError(String),
5
6    #[error("Route computation failed: no path found between {0} and {1}")]
7    NoRouteFound(String, String),
8
9    #[error("Invalid configuration: {0}")]
10    InvalidConfiguration(String),
11
12    #[error("Invalid network: {0}")]
13    InvalidNetwork(String),
14
15    #[error("Asset not found: {0}")]
16    AssetNotFound(String),
17
18    #[error("Invalid asset amount: {0}")]
19    InvalidAssetAmount(String),
20
21    #[error("RPC/Contract error: {0}")]
22    ContractError(#[from] alloy::contract::Error),
23
24    #[error(transparent)]
25    AlloyError(#[from] alloy::transports::TransportError),
26
27    #[error("Routing error: Token missing in computed path")]
28    MissingTokenInRoute,
29
30    #[error("Routing error: Quoter missing between path tokens")]
31    MissingQuoterInRoute,
32
33    #[error("Routing error: Path length mismatch (expected {expected}, got {actual})")]
34    PathLengthMismatch { expected: usize, actual: usize },
35
36    #[error("Parsing error: Invalid fiat symbol")]
37    InvalidFiatSymbol,
38
39    #[error("Parsing error: Invalid address - {0}")]
40    InvalidAddress(String),
41
42    #[error("ERC4626 vault token must have an on-chain address")]
43    MissingVaultAddress,
44
45    #[error("HTTP error: {0}")]
46    HttpError(#[from] reqwest::Error),
47
48    #[error("ECB CSV error: {0}")]
49    EcbCsvError(String),
50
51    #[error("ECB rate unavailable for fiat:{0}")]
52    EcbRateUnavailable(String),
53}
54
55pub type Result<T, E = EthPricesError> = std::result::Result<T, E>;