osdb/src/error_display.rs

27 lines
601 B
Rust
Raw Normal View History

use crate::{
command::CommandParseError, meta_commands::MetaCommandParseError,
statements::StatementParseError,
};
pub trait OSDBError {
fn display(&self, file: &str, input: &str);
}
impl OSDBError for MetaCommandParseError {
fn display(&self, file: &str, _input: &str) {
println!("{file}: {self}")
}
}
impl OSDBError for StatementParseError {
fn display(&self, file: &str, _input: &str) {
println!("{file}: {self}")
}
}
impl OSDBError for CommandParseError {
fn display(&self, file: &str, _input: &str) {
println!("{file}: {self}")
}
}