From 4b71bd433239739a104a7a3fe6b4aba4a2ad66e6 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 23 May 2021 00:39:31 +0200 Subject: Don't print root_cause if there's only one error in the chain If there's only one error in the chain, it prints: error: no matches for event ID: no matches for event ID Now, it will print: error: no matches for event ID and: error: unable to open OAuth secret file: Not a directory (os error 20) --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 5298c30..36c2b27 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,7 +42,13 @@ async fn main() { match run().await { Ok(_) => (), Err(e) => { - eprintln!("error: {}: {}", e, e.root_cause()); + eprint!("error"); + + for cause in e.chain() { + eprint!(": {}", cause); + } + + eprintln!(); process::exit(exitcode::SOFTWARE); }, -- cgit v1.2.3