use std::error::Error;
use std::fmt::{Display, Formatter, Result};
#[derive(Debug)]
pub struct ParserError {
cause: Option<Box<dyn Error>>,
details: String,
}
impl ParserError {
pub fn new(cause: Option<Box<dyn Error>>, details: String) -> Self {
Self {
cause,
details,
}
}
}
impl Display for ParserError {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
write!(f, "{}", self.details)
}
}
impl Error for ParserError {}