From dc162cb16707486fccbd017972dcf00f6aa9f76d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 15 Feb 2019 19:25:17 +0100 Subject: [PATCH] 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 --- lib/core/libimagerror/src/trace.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/libimagerror/src/trace.rs b/lib/core/libimagerror/src/trace.rs index 7894426c..66676c1e 100644 --- a/lib/core/libimagerror/src/trace.rs +++ b/lib/core/libimagerror/src/trace.rs @@ -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)?; } }