#[derive(Debug)]
pub enum Error {
InvalidHdKeyPath,
InvalidDescriptorChecksum,
HardenedDerivationXpub,
Key(crate::keys::KeyError),
Policy(crate::descriptor::policy::PolicyError),
InvalidDescriptorCharacter(u8),
Bip32(bitcoin::util::bip32::Error),
Base58(bitcoin::util::base58::Error),
Pk(bitcoin::util::key::Error),
Miniscript(miniscript::Error),
Hex(bitcoin::hashes::hex::Error),
}
impl From<crate::keys::KeyError> for Error {
fn from(key_error: crate::keys::KeyError) -> Error {
match key_error {
crate::keys::KeyError::Miniscript(inner) => Error::Miniscript(inner),
crate::keys::KeyError::Bip32(inner) => Error::Bip32(inner),
e => Error::Key(e),
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
impl std::error::Error for Error {}
impl_error!(bitcoin::util::bip32::Error, Bip32);
impl_error!(bitcoin::util::base58::Error, Base58);
impl_error!(bitcoin::util::key::Error, Pk);
impl_error!(miniscript::Error, Miniscript);
impl_error!(bitcoin::hashes::hex::Error, Hex);
impl_error!(crate::descriptor::policy::PolicyError, Policy);