Adapt graphical impl for DiagnosticChain

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2022-04-28 12:47:36 +02:00
parent cfc9c23265
commit 4cddd6e684
1 changed files with 6 additions and 2 deletions

View File

@ -199,8 +199,12 @@ impl GraphicalReportHandler {
writeln!(f, "{}", textwrap::fill(&diagnostic.to_string(), opts))?;
if let Some(cause) = diagnostic.source() {
let mut cause_iter = Chain::new(cause).peekable();
if let Some(mut cause_iter) = diagnostic
.diagnostic_source()
.map(DiagnosticChain::from_diagnostic)
.or_else(|| diagnostic.source().map(DiagnosticChain::from_stderror))
.map(|it| it.peekable())
{
while let Some(error) = cause_iter.next() {
let is_last = cause_iter.peek().is_none();
let char = if !is_last {