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("Token not found: {0}")]
13    TokenNotFound(String),
14
15    #[error("Invalid token amount: {0}")]
16    InvalidTokenAmount(String),
17
18    #[error("RPC/Contract error: {0}")]
19    ContractError(#[from] alloy::contract::Error),
20
21    #[error(transparent)]
22    AlloyError(#[from] alloy::transports::TransportError),
23
24    #[error("Routing error: Token missing in computed path")]
25    MissingTokenInRoute,
26
27    #[error("Routing error: Quoter missing between path tokens")]
28    MissingQuoterInRoute,
29
30    #[error("Routing error: Path length mismatch (expected {expected}, got {actual})")]
31    PathLengthMismatch { expected: usize, actual: usize },
32
33    #[error("Parsing error: Invalid fiat symbol")]
34    InvalidFiatSymbol,
35
36    #[error("Parsing error: Invalid address - {0}")]
37    InvalidAddress(String),
38
39    #[error("ERC4626 vault token must have an on-chain address")]
40    MissingVaultAddress,
41}
42
43pub type Result<T, E = EthPricesError> = std::result::Result<T, E>;