diff --git a/notes.org b/notes.org index 39d3be7..05e6c16 100644 --- a/notes.org +++ b/notes.org @@ -11,8 +11,12 @@ :LOGBOOK: CLOCK: [2025-05-03 sam. 18:40]--[2025-05-03 sam. 18:46] => 0:06 :END: -** TODO OSDBError::display() should take a filename and display it alongside the error - +** DONE OSDBError::display() should take a filename and display it alongside the error +:LOGBOOK: +CLOCK: [2025-05-03 sam. 21:24]--[2025-05-03 sam. 21:27] => 0:03 +:END: +** TODO OSDBError::display() should take an input string, to be able to resolve spans inside the error +** TODO OSDBError::display() should generate ariadne errors and return those * DONE snapshot testing ** DONE Find the snapshot testing library diff --git a/src/error_display.rs b/src/error_display.rs index 5a302ff..57a1bdf 100644 --- a/src/error_display.rs +++ b/src/error_display.rs @@ -4,23 +4,23 @@ use crate::{ }; pub trait OSDBError { - fn display(&self); + fn display(&self, file: &str); } impl OSDBError for MetaCommandParseError { - fn display(&self) { - println!("{self}") + fn display(&self, file: &str) { + println!("{file}: {self}") } } impl OSDBError for StatementParseError { - fn display(&self) { - println!("{self}") + fn display(&self, file: &str) { + println!("{file}: {self}") } } impl OSDBError for CommandParseError { - fn display(&self) { - println!("{self}") + fn display(&self, file: &str) { + println!("{file}: {self}") } } diff --git a/src/main.rs b/src/main.rs index a0fe1d0..99063ea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ fn main() { break; } } - Err(err) => err.display(), + Err(err) => err.display(""), } } println!("Good-bye");