forked from katzen-cafe/iowo
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:
parent
e7db9c38f3
commit
33aa131b95
1 changed files with 6 additions and 1 deletions
|
@ -39,8 +39,13 @@ mod error_reporting {
|
||||||
let offset = try_reconstruct_loc(src, err.line(), err.column());
|
let offset = try_reconstruct_loc(src, err.line(), err.column());
|
||||||
|
|
||||||
Report::build(ariadne::ReportKind::Error, "test", offset)
|
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_message(err.to_string())
|
||||||
|
.with_note(
|
||||||
|
"We'd like to give better errors, but serde errors are horrible to work with...",
|
||||||
|
)
|
||||||
.finish()
|
.finish()
|
||||||
.print(("test", Source::from(src)))
|
.print(("test", Source::from(src)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue