refactor(errors): error display function takes an input string to be able to resolve spans in the future
This commit is contained in:
parent
442c4b7beb
commit
4246775db5
3 changed files with 13 additions and 7 deletions
10
notes.org
10
notes.org
|
|
@ -13,9 +13,15 @@ CLOCK: [2025-05-03 sam. 18:40]--[2025-05-03 sam. 18:46] => 0:06
|
|||
:END:
|
||||
** 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
|
||||
CLOCK: [2025-05-03 sam. 21:24]--[2025-05-03 sam. 21:28] => 0:04
|
||||
:END:
|
||||
** DONE OSDBError::display() should take an input string, to be able to resolve spans inside the error
|
||||
:PROPERTIES:
|
||||
:EFFORT: 10
|
||||
:END:
|
||||
:LOGBOOK:
|
||||
CLOCK: [2025-05-03 sam. 21:28]--[2025-05-03 sam. 21:30] => 0:02
|
||||
: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
|
||||
|
||||
|
|
|
|||
|
|
@ -4,23 +4,23 @@ use crate::{
|
|||
};
|
||||
|
||||
pub trait OSDBError {
|
||||
fn display(&self, file: &str);
|
||||
fn display(&self, file: &str, input: &str);
|
||||
}
|
||||
|
||||
impl OSDBError for MetaCommandParseError {
|
||||
fn display(&self, file: &str) {
|
||||
fn display(&self, file: &str, _input: &str) {
|
||||
println!("{file}: {self}")
|
||||
}
|
||||
}
|
||||
|
||||
impl OSDBError for StatementParseError {
|
||||
fn display(&self, file: &str) {
|
||||
fn display(&self, file: &str, _input: &str) {
|
||||
println!("{file}: {self}")
|
||||
}
|
||||
}
|
||||
|
||||
impl OSDBError for CommandParseError {
|
||||
fn display(&self, file: &str) {
|
||||
fn display(&self, file: &str, _input: &str) {
|
||||
println!("{file}: {self}")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ fn main() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
Err(err) => err.display("<stdin>"),
|
||||
Err(err) => err.display("<stdin>", &input),
|
||||
}
|
||||
}
|
||||
println!("Good-bye");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue