1use thiserror::Error;
6
7#[derive(Error, Debug, PartialEq, Eq)]
8pub enum FaucetError {
9 #[error("Faucet cannot read objects from fullnode: {0}")]
10 FullnodeReading(String),
11
12 #[error("Failed to parse transaction response {0}")]
13 ParseTransactionResponse(String),
14
15 #[error(
16 "Gas coin `{0}` does not have sufficient balance and has been removed from gas coin pool"
17 )]
18 GasCoinWithInsufficientBalance(String),
19
20 #[error("Faucet does not have enough balance")]
21 InsufficientBalance,
22
23 #[error("Gas coin `{0}` is not valid and has been removed from gas coin pool")]
24 InvalidGasCoin(String),
25
26 #[error("Timed out waiting for a coin from the gas coin pool")]
27 NoGasCoinAvailable,
28
29 #[error("Wallet Error: `{0}`")]
30 Wallet(String),
31
32 #[error("Coin Transfer Failed `{0}`")]
33 Transfer(String),
34
35 #[error("Too many coins in the batch queue. Please try again later.")]
36 BatchSendQueueFull,
37
38 #[error("Request consumer queue closed.")]
39 ChannelClosed,
40
41 #[error("Coin amounts sent are incorrect:`{0}`")]
42 CoinAmountTransferredIncorrect(String),
43
44 #[error("Internal error: {0}")]
45 Internal(String),
46}
47
48impl FaucetError {
49 pub(crate) fn internal(e: impl ToString) -> Self {
50 FaucetError::Internal(e.to_string())
51 }
52}