hopr_chain_actions/
errors.rs1use thiserror::Error;
2
3use hopr_chain_rpc::errors::RpcError;
4use hopr_internal_types::prelude::CoreTypesError;
5use hopr_primitive_types::errors::GeneralError;
6
7#[derive(Debug, Error)]
9pub enum ChainActionsError {
10 #[error("channel is already opened")]
11 ChannelAlreadyExists,
12
13 #[error("channel does not exist")]
14 ChannelDoesNotExist,
15
16 #[error("channel is already closed")]
17 ChannelAlreadyClosed,
18
19 #[error("channel closure time has not elapsed yet, remaining {0}s")]
20 ClosureTimeHasNotElapsed(u64),
21
22 #[error("multiaddress has been already announced on-chain")]
23 AlreadyAnnounced,
24
25 #[error("network registry does not allow accessing this peer")]
26 PeerAccessDenied,
27
28 #[error("acknowledged {0} is in a wrong state for the operation")]
29 WrongTicketState(String),
30
31 #[error("given ticket has a superseded ticket index")]
32 OldTicket,
33
34 #[error("ticket is not a win")]
35 NotAWinningTicket,
36
37 #[error("balance is too low to perform the operation")]
38 BalanceTooLow,
39
40 #[error("safe does not have enough allowance to fund channel")]
41 NotEnoughAllowance,
42
43 #[error("on-chain submission of transaction failed: {0}")]
44 TransactionSubmissionFailed(String),
45
46 #[error("invalid argument: {0}")]
47 InvalidArguments(String),
48
49 #[error("invalid state: {0}")]
50 InvalidState(String),
51
52 #[error("timeout waiting for action confirmation")]
53 Timeout,
54
55 #[error("indexer expectation has been unregistered")]
56 ExpectationUnregistered,
57
58 #[error("no channel domain_separator tag found")]
59 MissingDomainSeparator,
60
61 #[error(transparent)]
62 DbBackendError(#[from] hopr_db_sql::errors::DbSqlError),
63
64 #[error(transparent)]
65 DbError(#[from] hopr_db_sql::api::errors::DbError),
66
67 #[error(transparent)]
68 RpcError(#[from] RpcError),
69
70 #[error(transparent)]
71 CoreTypesError(#[from] CoreTypesError),
72
73 #[error(transparent)]
74 GeneralError(#[from] GeneralError),
75}
76
77pub type Result<T> = std::result::Result<T, ChainActionsError>;