feat(error): display filename with the error message
This commit is contained in:
parent
32cfdfa07f
commit
442c4b7beb
3 changed files with 14 additions and 10 deletions
|
|
@ -11,8 +11,12 @@
|
||||||
:LOGBOOK:
|
:LOGBOOK:
|
||||||
CLOCK: [2025-05-03 sam. 18:40]--[2025-05-03 sam. 18:46] => 0:06
|
CLOCK: [2025-05-03 sam. 18:40]--[2025-05-03 sam. 18:46] => 0:06
|
||||||
:END:
|
: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 snapshot testing
|
||||||
|
|
||||||
** DONE Find the snapshot testing library
|
** DONE Find the snapshot testing library
|
||||||
|
|
|
||||||
|
|
@ -4,23 +4,23 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait OSDBError {
|
pub trait OSDBError {
|
||||||
fn display(&self);
|
fn display(&self, file: &str);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OSDBError for MetaCommandParseError {
|
impl OSDBError for MetaCommandParseError {
|
||||||
fn display(&self) {
|
fn display(&self, file: &str) {
|
||||||
println!("{self}")
|
println!("{file}: {self}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OSDBError for StatementParseError {
|
impl OSDBError for StatementParseError {
|
||||||
fn display(&self) {
|
fn display(&self, file: &str) {
|
||||||
println!("{self}")
|
println!("{file}: {self}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OSDBError for CommandParseError {
|
impl OSDBError for CommandParseError {
|
||||||
fn display(&self) {
|
fn display(&self, file: &str) {
|
||||||
println!("{self}")
|
println!("{file}: {self}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ fn main() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => err.display(),
|
Err(err) => err.display("<stdin>"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println!("Good-bye");
|
println!("Good-bye");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue