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
|
|
@ -12,7 +12,11 @@ impl OSDBError for CommandParseError {
|
|||
} else {
|
||||
Report::build(ReportKind::Error, (file, 0..input.len() - 1))
|
||||
.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()
|
||||
.print((file, Source::from(input)))
|
||||
.unwrap();
|
||||
|
|
@ -25,7 +29,11 @@ impl OSDBError for ScanError {
|
|||
let location = (file, Into::<std::ops::Range<usize>>::into(&self.location));
|
||||
Report::build(ReportKind::Error, location.clone())
|
||||
.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()
|
||||
.print((file, Source::from(input)))
|
||||
.unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue