krusty_kms_common/
error.rs1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, KmsError>;
6
7#[derive(Error, Debug)]
8pub enum KmsError {
9 #[error("Invalid public key format: {0}")]
10 InvalidPublicKey(String),
11
12 #[error("Invalid private key: {0}")]
13 InvalidPrivateKey(String),
14
15 #[error("Invalid mnemonic: {0}")]
16 InvalidMnemonic(String),
17
18 #[error("Cryptographic operation failed: {0}")]
19 CryptoError(String),
20
21 #[error("Serialization error: {0}")]
22 SerializationError(String),
23
24 #[error("Deserialization error: {0}")]
25 DeserializationError(String),
26
27 #[error("Invalid amount: {0}")]
28 InvalidAmount(String),
29
30 #[error("Insufficient balance: available={available}, required={required}")]
31 InsufficientBalance { available: u128, required: u128 },
32
33 #[error("Invalid derivation path: {0}")]
34 InvalidDerivationPath(String),
35
36 #[error("Hex decoding error: {0}")]
37 HexError(#[from] hex::FromHexError),
38
39 #[error("JSON error: {0}")]
40 JsonError(#[from] serde_json::Error),
41
42 #[error("Starknet crypto error: {0}")]
43 StarknetCryptoError(String),
44
45 #[error("Point at infinity")]
46 PointAtInfinity,
47
48 #[error("Invalid proof: {0}")]
49 InvalidProof(String),
50
51 #[error("RPC error: {0}")]
52 RpcError(String),
53
54 #[error("Account not deployed at {0}")]
55 AccountNotDeployed(String),
56
57 #[error("Account already deployed at {0}")]
58 AlreadyDeployed(String),
59
60 #[error("Insufficient fee balance for deployment: {0}")]
61 InsufficientFeeBalance(String),
62
63 #[error("Invalid class hash: {0}")]
64 InvalidClassHash(String),
65
66 #[error("Contract not found: {0}")]
67 ContractNotFound(String),
68
69 #[error("Transaction error: {0}")]
70 TransactionError(String),
71
72 #[error("Transaction reverted: {0}")]
73 TransactionReverted(String),
74
75 #[error("Fee estimation failed: {0}")]
76 FeeEstimationFailed(String),
77
78 #[error("Timeout: {0}")]
79 Timeout(String),
80
81 #[error("Staking error: {0}")]
82 StakingError(String),
83
84 #[error("Controller error: {0}")]
85 ControllerError(String),
86}