hopr_strategy/
errors.rs

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