hopr_chain_api/
errors.rs

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