22 lines
546 B
Rust
22 lines
546 B
Rust
|
#[derive(Debug)]
|
||
|
pub enum Error {
|
||
|
KeyMismatch(bitcoin::secp256k1::PublicKey, bitcoin::secp256k1::PublicKey),
|
||
|
MissingInputUTXO(usize),
|
||
|
|
||
|
BIP32(bitcoin::util::bip32::Error),
|
||
|
Secp256k1(bitcoin::secp256k1::Error),
|
||
|
}
|
||
|
|
||
|
macro_rules! impl_error {
|
||
|
( $from:ty, $to:ident ) => {
|
||
|
impl std::convert::From<$from> for Error {
|
||
|
fn from(err: $from) -> Self {
|
||
|
Error::$to(err)
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
impl_error!(bitcoin::util::bip32::Error, BIP32);
|
||
|
impl_error!(bitcoin::secp256k1::Error, Secp256k1);
|