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
This commit is contained in:
Schrottkatze 2024-01-11 16:54:55 +01:00
parent deb152da90
commit d399537125
Signed by: schrottkatze
GPG key ID: DFD0FD205943C14A

View file

@ -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();