Skip to content

Commit

Permalink
fix(graphical): correctly space related errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLostLambda committed Mar 27, 2024
1 parent 786d11b commit 32f8f4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/handlers/graphical.rs
Expand Up @@ -401,8 +401,8 @@ impl GraphicalReportHandler {
let mut inner_renderer = self.clone();
// Re-enable the printing of nested cause chains for related errors
inner_renderer.with_cause_chain = true;
writeln!(f)?;
for rel in related {
writeln!(f)?;
match rel.severity() {
Some(Severity::Error) | None => write!(f, "Error: ")?,
Some(Severity::Warning) => write!(f, "Warning: ")?,
Expand Down
5 changes: 4 additions & 1 deletion tests/graphical.rs
Expand Up @@ -389,11 +389,13 @@ fn wrapping_related_errors() -> Result<(), MietteError> {
help: it cannot be helped... woulddddddd
you really want to get rid of an
error that's so cute?
Warning:
⚠ Wah wah: I may be small, but I'll
│ cause a proper bout of trouble — justt
│ try wrapping this mess of a line,
│ buddo!
Advice:
☞ Wah wah: I may be small, but I'll
│ cause a proper bout of trouble — justt
Expand Down Expand Up @@ -1557,7 +1559,6 @@ Error: oops::my::bad
2 │ text
╰────
help: try doing it better next time?
"#
.trim_start()
.to_string();
Expand Down Expand Up @@ -1724,6 +1725,7 @@ Error: oops::my::related::error
2 │ text
╰────
help: try doing it better next time?
Warning: oops::my::related::warning
⚠ oops!
Expand All @@ -1734,6 +1736,7 @@ Warning: oops::my::related::warning
2 │ text
╰────
help: try doing it better next time?
Advice: oops::my::related::advice
☞ oops!
Expand Down
1 change: 1 addition & 0 deletions tests/test_diagnostic_source_macro.rs
Expand Up @@ -276,6 +276,7 @@ fn test_nested_cause_chains_for_related_errors_are_output() {
· ──┬─
· ╰── here
╰────
Error:
× A complex error happened
╭────
Expand Down

0 comments on commit 32f8f4c

Please sign in to comment.