use std::error::Error;
use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExpressionParseException {
message: String,
position: i32,
}
impl ExpressionParseException {
pub fn new(message: impl Into<String>, position: i32) -> Self {
Self {
message: message.into(),
position,
}
}
pub fn message(&self) -> &str {
&self.message
}
pub fn position(&self) -> i32 {
self.position
}
}
impl fmt::Display for ExpressionParseException {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.message)
}
}
impl Error for ExpressionParseException {}