1use std::num::ParseIntError;
4
5use thiserror::Error as ThisError;
6
7use crate::transaction::Version;
8
9#[derive(Debug, ThisError)]
10pub enum Error {
11 #[error("Failed to confirm transaction after {0} tries.")]
12 UnableToConfirmTransaction(u32),
13
14 #[error("{0} is not a valid base-16 address")]
15 InvalidAddress(String),
16
17 #[error("Private key is not correct")]
18 IncorrectPrivateKey,
19
20 #[error("Provided txn hash {0} is invalid.")]
21 InvalidTransactionHash(String),
22
23 #[error("Version ({0}) set for the transaction is invalid")]
24 InvalidVersionIsSetForTransaction(Version),
25
26 #[error("No signers specified, unable to send/sign.")]
27 NoSignerSpecified,
28
29 #[error("Account with address {0} does not exist")]
30 AccountDoesNotExist(String),
31
32 #[error("Default account is not set for the wallet")]
33 DefaultAccountIsNotSet,
34
35 #[error("Unknown units: {0}")]
36 UnrecognizedUnits(String),
37
38 #[error("Negative values are not allowed")]
39 NegativeValueNotAllowed,
40
41 #[error("Parse overflow")]
42 ParseOverflow,
43
44 #[error("Field {0} doesn't exist in the contract.")]
45 NoSuchFieldInContractState(String),
46
47 #[error("Field {0} doesn't exist in the contract init.")]
48 NoSuchFieldInContractInit(String),
49
50 #[error("Failed to parse scilla value {0} as {1} type")]
51 FailedToParseScillaValue(String, String),
52
53 #[error("Failed to parse {0}.")]
54 FailedToParseContractField(String),
55
56 #[error("A directory was specified when a file was expected.")]
57 IsADirectory,
58
59 #[error("Failed to get the parent directory of the given path")]
60 FailedToGetTheParentDirectory,
61
62 #[error(transparent)]
63 JsonRpcError(#[from] jsonrpsee::core::ClientError),
64
65 #[error(transparent)]
66 FromHexError(#[from] hex::FromHexError),
67
68 #[error(transparent)]
69 K256k1Error(#[from] k256::elliptic_curve::Error),
70
71 #[error(transparent)]
72 UrlParseError(#[from] url::ParseError),
73
74 #[error(transparent)]
75 Bech32Error(#[from] bech32::Error),
76
77 #[error(transparent)]
78 JsonError(#[from] serde_json::Error),
79
80 #[error(transparent)]
81 IoError(#[from] std::io::Error),
82
83 #[error(transparent)]
84 ParseIntError(#[from] ParseIntError),
85
86 #[error(transparent)]
87 KeystoreError(#[from] eth_keystore::KeystoreError),
88
89 #[error(transparent)]
90 RegexError(#[from] regex::Error),
91}