hopr_chain_indexer/
errors.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use ethers::core::abi::Error as AbiError;
use thiserror::Error;

use hopr_primitive_types::{errors::GeneralError, primitives::Address};

#[derive(Error, Debug)]
pub enum CoreEthereumIndexerError {
    #[error("{0}")]
    ProcessError(String),

    #[error(transparent)]
    DbApiError(#[from] hopr_db_sql::errors::DbSqlError),

    #[error(transparent)]
    DbError(#[from] hopr_db_sql::api::errors::DbError),

    #[error(transparent)]
    DbEntityError(#[from] hopr_db_entity::errors::DbEntityError),

    #[error(transparent)]
    AbiError(#[from] AbiError),

    #[error(transparent)]
    GeneralError(#[from] GeneralError),

    #[error("{0}")]
    ValidationError(String),

    #[error("Address announcement without a preceding key binding.")]
    AnnounceBeforeKeyBinding,

    #[error("Address announcement contains empty Multiaddr.")]
    AnnounceEmptyMultiaddr,

    #[error("Node has already announced a key binding. Reassigning keys is not supported.")]
    UnsupportedKeyRebinding,

    #[error("Address revocation before key binding.")]
    RevocationBeforeKeyBinding,

    #[error("Could not verify account entry signature. Maybe a cross-signing issue?")]
    AccountEntrySignatureVerification,

    #[error("Received an event for a channel that is closed or for which we haven't seen an OPEN event.")]
    ChannelDoesNotExist,

    #[error("Cannot deregister non-existent MFA module")]
    MFAModuleDoesNotExist,

    #[error("Unknown smart contract. Received event from {0}")]
    UnknownContract(Address),

    #[error(transparent)]
    MultiaddrParseError(#[from] multiaddr::Error),

    #[error(transparent)]
    RpcError(#[from] hopr_chain_rpc::errors::RpcError),
}

pub type Result<T> = core::result::Result<T, CoreEthereumIndexerError>;