use std::{error::Error, fmt, num::ParseIntError};
pub mod v2;
#[derive(Debug, Clone)]
pub struct ParseError(String);
impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.0)
}
}
impl Error for ParseError {}
impl From<serde_json::Error> for ParseError
where
serde_json::Error: std::fmt::Debug,
{
fn from(error: serde_json::Error) -> Self {
ParseError(format!("{:?}", error))
}
}
impl From<ParseIntError> for ParseError
where
serde_json::Error: std::fmt::Debug,
{
fn from(error: ParseIntError) -> Self {
ParseError(format!("{:?}", error))
}
}