hopr_chain_api/
errors.rs

1use thiserror::Error;
2
3/// Error representing all possible erroneous states of the entire HOPR
4/// on-chain interactions.
5#[derive(Error, Debug)]
6pub enum HoprChainError {
7    #[error("API error: {0}")]
8    Api(String),
9
10    #[error("rpc error: {0}")]
11    Rpc(#[from] hopr_chain_rpc::errors::RpcError),
12
13    #[error("indexer error: {0}")]
14    Indexer(#[from] hopr_chain_indexer::errors::CoreEthereumIndexerError),
15
16    #[error(transparent)]
17    DbError(#[from] hopr_db_sql::errors::DbSqlError),
18
19    #[error("configuration error: {0}")]
20    Configuration(String),
21}
22
23/// The default [Result] object translating errors in the [HoprChainError] type
24pub type Result<T> = core::result::Result<T, HoprChainError>;