hopr_strategy/
errors.rs

1use thiserror::Error;
2
3use hopr_chain_actions::errors::ChainActionsError;
4use hopr_primitive_types::errors::GeneralError;
5
6/// Enumerates all errors in this crate.
7#[derive(Debug, Error)]
8pub enum StrategyError {
9    #[error("criteria to trigger the strategy were not satisfied")]
10    CriteriaNotSatisfied,
11
12    #[error("non-specific strategy error: {0}")]
13    Other(String),
14
15    #[error(transparent)]
16    DbError(#[from] hopr_db_sql::api::errors::DbError),
17
18    #[error(transparent)]
19    ProtocolError(#[from] hopr_transport_protocol::errors::ProtocolError),
20
21    #[error(transparent)]
22    ActionsError(#[from] ChainActionsError),
23
24    #[error("lower-level error: {0}")]
25    GeneralError(#[from] GeneralError),
26}
27
28pub type Result<T> = std::result::Result<T, StrategyError>;