hopr_chain_indexer/
errors.rs

1use alloy::{dyn_abi::Error as AbiError, sol_types::Error as SolTypeError};
2use hopr_primitive_types::{errors::GeneralError, primitives::Address};
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum CoreEthereumIndexerError {
7    #[error("{0}")]
8    ProcessError(String),
9
10    #[error(transparent)]
11    DbApiError(#[from] hopr_db_sql::errors::DbSqlError),
12
13    #[error(transparent)]
14    DbEntityError(#[from] hopr_db_entity::errors::DbEntityError),
15
16    #[error(transparent)]
17    AbiError(#[from] AbiError),
18
19    #[error(transparent)]
20    SolTypeError(#[from] SolTypeError),
21
22    #[error(transparent)]
23    GeneralError(#[from] GeneralError),
24
25    #[error("{0}")]
26    ValidationError(String),
27
28    #[error("Address announcement without a preceding key binding.")]
29    AnnounceBeforeKeyBinding,
30
31    #[error("Address announcement contains empty Multiaddr.")]
32    AnnounceEmptyMultiaddr,
33
34    #[error("Node has already announced a key binding. Reassigning keys is not supported.")]
35    UnsupportedKeyRebinding,
36
37    #[error("Address revocation before key binding.")]
38    RevocationBeforeKeyBinding,
39
40    #[error("Could not verify account entry signature. Maybe a cross-signing issue?")]
41    AccountEntrySignatureVerification,
42
43    #[error("Received an event for a channel that is closed or for which we haven't seen an OPEN event.")]
44    ChannelDoesNotExist,
45
46    #[error("Cannot deregister non-existent MFA module")]
47    MFAModuleDoesNotExist,
48
49    #[error("Unknown smart contract. Received event from {0}")]
50    UnknownContract(Address),
51
52    #[error(transparent)]
53    MultiaddrParseError(#[from] multiaddr::Error),
54
55    #[error(transparent)]
56    RpcError(#[from] hopr_chain_rpc::errors::RpcError),
57
58    #[error("node db error: {0}")]
59    NodeDbError(Box<dyn std::error::Error + Send + Sync + 'static>),
60
61    #[error("Snapshot error: {0}")]
62    SnapshotError(String),
63}
64
65pub type Result<T> = core::result::Result<T, CoreEthereumIndexerError>;