fix(graphical): correctly space related errors

This commit is contained in:
Brooks J Rady 2024-03-26 18:43:48 -07:00
parent 786d11b351
commit 32f8f4c520
3 changed files with 6 additions and 2 deletions

View File

@ -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: ")?,

View File

@ -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
@ -1557,7 +1559,6 @@ Error: oops::my::bad
2 text
help: try doing it better next time?
"#
.trim_start()
.to_string();
@ -1724,6 +1725,7 @@ Error: oops::my::related::error
2 text
help: try doing it better next time?
Warning: oops::my::related::warning
oops!
@ -1734,6 +1736,7 @@ Warning: oops::my::related::warning
2 text
help: try doing it better next time?
Advice: oops::my::related::advice
oops!

View File

@ -276,6 +276,7 @@ fn test_nested_cause_chains_for_related_errors_are_output() {
·
· here
Error:
× A complex error happened