mirror of https://github.com/zkat/miette.git
fix: don't drop cause-chain when rendering related errors as nested
Previously, using the show_related_errors_as_nested feature introduced
in 771a075, any cause-chain of those nested errors would be dropped,
so the information would get lost.
This commit is contained in:
parent
e853bbf9bc
commit
db3cf48631
|
|
@ -504,7 +504,10 @@ impl GraphicalReportHandler {
|
||||||
|
|
||||||
let mut inner_renderer = self.clone();
|
let mut inner_renderer = self.clone();
|
||||||
inner_renderer.footer = None;
|
inner_renderer.footer = None;
|
||||||
inner_renderer.with_cause_chain = false;
|
// Each related error is an independent diagnostic whose cause
|
||||||
|
// chain has not been flattened, so keep printing it to avoid
|
||||||
|
// dropping the source chain and its details.
|
||||||
|
inner_renderer.with_cause_chain = true;
|
||||||
inner_renderer.termwidth -= rest_indent.width();
|
inner_renderer.termwidth -= rest_indent.width();
|
||||||
inner_renderer.render_report_inner(&mut inner, rel, src)?;
|
inner_renderer.render_report_inner(&mut inner, rel, src)?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -345,6 +345,16 @@ fn test_display_related_errors_as_nested() {
|
||||||
× A multi-error happened
|
× A multi-error happened
|
||||||
├─▶ × A multi-error happened
|
├─▶ × A multi-error happened
|
||||||
│ ├─▶ × A nested error happened
|
│ ├─▶ × A nested error happened
|
||||||
|
│ │ ├─▶ × TestError
|
||||||
|
│ │ │
|
||||||
|
│ │ ╰─▶ × A complex error happened
|
||||||
|
│ │ ╭────
|
||||||
|
│ │ 1 │ This is another error
|
||||||
|
│ │ · ──┬─
|
||||||
|
│ │ · ╰── here
|
||||||
|
│ │ ╰────
|
||||||
|
│ │ help: You should fix this
|
||||||
|
│ │
|
||||||
│ │ ╭────
|
│ │ ╭────
|
||||||
│ │ 1 │ right here
|
│ │ 1 │ right here
|
||||||
│ │ · ──┬─
|
│ │ · ──┬─
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue