hopr_db_api/
errors.rs

1use hopr_crypto_types::prelude::Hash;
2use hopr_internal_types::tickets::Ticket;
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum DbError {
7    #[error("DB general error: {0}")]
8    General(String),
9
10    #[error("log status not found")]
11    MissingLogStatus,
12
13    #[error("log not found")]
14    MissingLog,
15
16    #[error("addresses and topics used to fetch logs are inconsistent")]
17    InconsistentLogs,
18
19    #[error("account entry for announcement not found")]
20    MissingAccount,
21
22    #[error("channel not found: {0}")]
23    ChannelNotFound(Hash),
24
25    #[error("ticket aggregation error: {0}")]
26    TicketAggregationError(String),
27
28    #[error("ticket validation error for {:?}: {}", 0.0, 0.1)]
29    TicketValidationError(Box<(Ticket, String)>),
30
31    #[error("logical error: {0}")]
32    LogicalError(String),
33}
34
35pub type Result<T> = std::result::Result<T, DbError>;