simple_crypto/
error.rs

1#[derive(thiserror::Error, Debug)]
2pub enum Error {
3    #[error(transparent)]
4    SerdeJson(#[from] serde_json::Error),
5    #[error(transparent)]
6    Hex(#[from] hex::FromHexError),
7    #[error(transparent)]
8    Secp256k1(#[from] secp256k1::Error),
9    #[error(transparent)]
10    BitcoinBip32(#[from] bitcoin::bip32::Error),
11    #[error(transparent)]
12    HashFromSlice(#[from] bitcoin_hashes::FromSliceError),
13    #[error(transparent)]
14    Bip324(#[from] crate::bip324::Error),
15
16    #[error("Generic Error {0}: {1}")]
17    Generic(String, String),
18}
19
20impl Error {
21    pub fn err(ctx: &str, err: &str) -> Self {Error::Generic(ctx.to_string(), err.to_string())}
22}