use core::num::ParseIntError;
use bitcoin::{consensus, hex};
#[derive(Debug)]
pub enum Error<E> {
Decode(consensus::encode::Error),
DecodeHex(consensus::encode::FromHexError),
HexToArray(hex::HexToArrayError),
Json(serde_json::Error),
ParseInt(ParseIntError),
Http(E),
}
impl<E: core::fmt::Display> core::fmt::Display for Error<E> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Decode(e) => write!(f, "{e}"),
Self::DecodeHex(e) => write!(f, "{e}"),
Self::HexToArray(e) => write!(f, "{e}"),
Self::Json(e) => write!(f, "{e}"),
Self::ParseInt(e) => write!(f, "{e}"),
Self::Http(e) => write!(f, "{e}"),
}
}
}
impl<E> std::error::Error for Error<E> where E: core::fmt::Debug + core::fmt::Display {}