hopr_db_api/
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
use hopr_crypto_types::prelude::Hash;
use hopr_internal_types::tickets::Ticket;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum DbError {
    #[error("DB general error: {0}")]
    General(String),

    #[error("log status not found")]
    MissingLogStatus,

    #[error("log not found")]
    MissingLog,

    #[error("addresses and topics used to fetch logs are inconsistent")]
    InconsistentLogs,

    #[error("account entry for announcement not found")]
    MissingAccount,

    #[error("channel not found: {0}")]
    ChannelNotFound(Hash),

    #[error("ticket aggregation error: {0}")]
    TicketAggregationError(String),

    #[error("ticket validation error for {:?}: {}", 0.0, 0.1)]
    TicketValidationError(Box<(Ticket, String)>),

    #[error("logical error: {0}")]
    LogicalError(String),
}

pub type Result<T> = std::result::Result<T, DbError>;