1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum WalletError {
8 #[error("protocol error (code {code}): {message}")]
10 Protocol { code: u8, message: String },
11
12 #[error("invalid parameter: {0}")]
14 InvalidParameter(String),
15
16 #[error("not implemented: {0}")]
18 NotImplemented(String),
19
20 #[error("internal error: {0}")]
22 Internal(String),
23}
24
25impl From<crate::primitives::PrimitivesError> for WalletError {
26 fn from(e: crate::primitives::PrimitivesError) -> Self {
27 WalletError::Internal(e.to_string())
28 }
29}
30
31impl From<crate::script::ScriptError> for WalletError {
32 fn from(e: crate::script::ScriptError) -> Self {
33 WalletError::Internal(e.to_string())
34 }
35}
36
37impl From<crate::transaction::TransactionError> for WalletError {
38 fn from(e: crate::transaction::TransactionError) -> Self {
39 WalletError::Internal(e.to_string())
40 }
41}