use sqlparser::parser::ParserError;
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PostgresParseError {
pub message: String,
}
impl fmt::Display for PostgresParseError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.message)
}
}
impl std::error::Error for PostgresParseError {}
impl From<ParserError> for PostgresParseError {
fn from(error: ParserError) -> Self {
let message = match error {
ParserError::ParserError(message) | ParserError::TokenizerError(message) => message,
ParserError::RecursionLimitExceeded => error.to_string(),
};
Self { message }
}
}