From 8553ae7a5a5001afe806df526c740ef4c29fadf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Fri, 30 May 2025 13:44:35 +0200 Subject: [PATCH] fix(error display): print errors to stderr --- notes.org | 4 +++- src/error_display.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/notes.org b/notes.org index 3759fa5..12d8410 100644 --- a/notes.org +++ b/notes.org @@ -222,7 +222,9 @@ i will use rustyline, since it seems like the most feature-complete * DONE better error message display for unclosed " in string -* TODO print errors to stderr +* DONE print errors to stderr + +* TODO write a proper grammar * TODO parse insert statements in the form insert diff --git a/src/error_display.rs b/src/error_display.rs index 0f8bd14..45b237c 100644 --- a/src/error_display.rs +++ b/src/error_display.rs @@ -22,7 +22,7 @@ impl OSDBError for CommandParseError { ) .with_note(format!("expected token type to be one of {items:?}")) .finish() - .print((file, Source::from(input))) + .eprint((file, Source::from(input))) .unwrap() } } @@ -60,6 +60,6 @@ impl OSDBError for ScanError { .with_message(format!("{self}")), ), }; - report.finish().print((file, Source::from(input))).unwrap(); + report.finish().eprint((file, Source::from(input))).unwrap(); } }