Fix: Off by one error

When printing the error chain, we print the error and then iterate over
the causes. Hence, we have to increase the printed number by one here,
because 0 (zero) is already printed.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-02-15 19:25:17 +01:00
parent 2611583839
commit dc162cb167

View file

@ -41,7 +41,7 @@ impl<'a> Display for ImagTrace<'a, Error>
for (i, cause) in self.0.iter_causes().enumerate() {
let _ = writeln!(fmt,
"{prefix}: {error}",
prefix = Red.blink().paint(format!("ERROR[{:>4}]", i)),
prefix = Red.blink().paint(format!("ERROR[{:>4}]", i + 1)),
error = cause)?;
}
}