From 33aa131b95281a377dd0d7081acb60feaef3f0f3 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Thu, 11 Jan 2024 16:54:55 +0100 Subject: [PATCH] app: improve errors a bit more added a message to the label so the position of the error gets shown and a note to make clear we don't have enough info for better error messages thanks to serde --- crates/app/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index a96ef3f..b5de824 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -39,8 +39,13 @@ mod error_reporting { let offset = try_reconstruct_loc(src, err.line(), err.column()); Report::build(ariadne::ReportKind::Error, "test", offset) - .with_label(Label::new(("test", offset..offset))) + .with_label( + Label::new(("test", offset..offset)).with_message("Something went wrong here!"), + ) .with_message(err.to_string()) + .with_note( + "We'd like to give better errors, but serde errors are horrible to work with...", + ) .finish() .print(("test", Source::from(src))) .unwrap();