Merge pull request #1187 from matthiasbeyer/libimagerror/display-fix

Improve error output
This commit is contained in:
Matthias Beyer 2018-01-01 20:47:24 +01:00 committed by GitHub
commit 529f3f83da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,7 +90,7 @@ fn print_trace_maxdepth(idx: u64, e: &Error, max: u64) -> Option<&Error> {
} else { } else {
write!(stderr(), "\n").ok(); write!(stderr(), "\n").ok();
} }
write!(stderr(), "{}: {}", Red.paint(format!("ERROR[{:>4}]", idx)), e.description()).ok(); write!(stderr(), "{}: {}", Red.paint(format!("ERROR[{:>4}]", idx)), e).ok();
e.cause() e.cause()
} }
@ -100,7 +100,7 @@ fn count_error_causes(e: &Error) -> u64 {
} }
fn print_trace_dbg(idx: u64, e: &Error) { fn print_trace_dbg(idx: u64, e: &Error) {
debug!("{}: {}", Red.blink().paint(format!("ERROR[{:>4}]", idx)), e.description()); debug!("{}: {}", Red.blink().paint(format!("ERROR[{:>4}]", idx)), e);
if e.cause().is_some() { if e.cause().is_some() {
e.cause().map(|c| print_trace_dbg(idx + 1, c)); e.cause().map(|c| print_trace_dbg(idx + 1, c));
} }