From aa71c6bf4abf11aae8093db0315050708ea0c438 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 18:27:07 +0200 Subject: [PATCH] Include source error message when failing --load Fixes #59 --- bin/bffhd/main.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 4507d90..6c4dd02 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -122,17 +122,14 @@ fn main() -> anyhow::Result<()> { unimplemented!() } else if matches.is_present("load") { let bffh = Diflouroborane::new(config)?; - if bffh - .users - .load_file(matches.value_of("load").unwrap()) - .is_ok() - { - tracing::info!("loaded users from {}", matches.value_of("load").unwrap()); - } else { + if let Err(error) = bffh.users.load_file(matches.value_of("load").unwrap()) { tracing::error!( - "failed to load users from {}", - matches.value_of("load").unwrap() + "failed to load users from {}: {}", + matches.value_of("load").unwrap(), + error, ); + } else { + tracing::info!("loaded users from {}", matches.value_of("load").unwrap()); } return Ok(()); } else {