feat(error_report): show proeminent marking on error location
This commit is contained in:
parent
9b75cb6144
commit
620259af48
2 changed files with 12 additions and 2 deletions
|
|
@ -208,6 +208,8 @@ i will use rustyline, since it seems like the most feature-complete
|
||||||
|
|
||||||
* DONE handle non-interactive input better
|
* DONE handle non-interactive input better
|
||||||
|
|
||||||
|
* DONE show marking where error occurs
|
||||||
|
|
||||||
* TODO cli tests using insta-cmd
|
* TODO cli tests using insta-cmd
|
||||||
https://insta.rs/docs/cmd/
|
https://insta.rs/docs/cmd/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,11 @@ impl OSDBError for CommandParseError {
|
||||||
} else {
|
} else {
|
||||||
Report::build(ReportKind::Error, (file, 0..input.len() - 1))
|
Report::build(ReportKind::Error, (file, 0..input.len() - 1))
|
||||||
.with_message(self.message())
|
.with_message(self.message())
|
||||||
.with_label(Label::new((file, 0..input.len() - 1)).with_color(Color::Red))
|
.with_label(
|
||||||
|
Label::new((file, 0..input.len() - 1))
|
||||||
|
.with_color(Color::Red)
|
||||||
|
.with_message(self.message()),
|
||||||
|
)
|
||||||
.finish()
|
.finish()
|
||||||
.print((file, Source::from(input)))
|
.print((file, Source::from(input)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
@ -25,7 +29,11 @@ impl OSDBError for ScanError {
|
||||||
let location = (file, Into::<std::ops::Range<usize>>::into(&self.location));
|
let location = (file, Into::<std::ops::Range<usize>>::into(&self.location));
|
||||||
Report::build(ReportKind::Error, location.clone())
|
Report::build(ReportKind::Error, location.clone())
|
||||||
.with_message(format!("{self}"))
|
.with_message(format!("{self}"))
|
||||||
.with_label(Label::new(location).with_color(Color::Red))
|
.with_label(
|
||||||
|
Label::new(location)
|
||||||
|
.with_color(Color::Red)
|
||||||
|
.with_message(format!("{self}")),
|
||||||
|
)
|
||||||
.finish()
|
.finish()
|
||||||
.print((file, Source::from(input)))
|
.print((file, Source::from(input)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue