1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum ApiError {
8 #[error("HTTP request failed: {0}")]
10 Request(#[from] reqwest::Error),
11
12 #[error("GraphQL error: {0}")]
14 GraphQL(String),
15
16 #[error("Failed to parse response: {0}")]
18 Parse(String),
19
20 #[error("Vault not found: {address} on chain {chain_id}")]
22 VaultNotFound { address: String, chain_id: i64 },
23
24 #[error("Invalid address format: {0}")]
26 InvalidAddress(String),
27
28 #[error("Invalid chain ID: {0}")]
30 InvalidChainId(i64),
31
32 #[error("Contract error: {0}")]
34 Contract(#[from] morpho_rs_contracts::ContractError),
35
36 #[error("Transaction support not configured: RPC URL and private key required")]
38 TransactionNotConfigured,
39}
40
41pub type Result<T> = std::result::Result<T, ApiError>;