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("cannot find a surb: {0}")]
26    NoSurbAvailable(String),
27
28    #[error("ticket aggregation error: {0}")]
29    TicketAggregationError(String),
30
31    #[error("ticket validation error for {:?}: {}", 0.0, 0.1)]
32    TicketValidationError(Box<(Ticket, String)>),
33
34    #[error("logical error: {0}")]
35    LogicalError(String),
36}
37
38pub type Result<T> = std::result::Result<T, DbError>;