Include source error message when failing --load

Fixes #59
This commit is contained in:
Nadja Reitzenstein 2022-05-20 18:27:07 +02:00
parent d35477c806
commit aa71c6bf4a

View File

@ -122,17 +122,14 @@ fn main() -> anyhow::Result<()> {
unimplemented!() unimplemented!()
} else if matches.is_present("load") { } else if matches.is_present("load") {
let bffh = Diflouroborane::new(config)?; let bffh = Diflouroborane::new(config)?;
if bffh if let Err(error) = bffh.users.load_file(matches.value_of("load").unwrap()) {
.users
.load_file(matches.value_of("load").unwrap())
.is_ok()
{
tracing::info!("loaded users from {}", matches.value_of("load").unwrap());
} else {
tracing::error!( tracing::error!(
"failed to load users from {}", "failed to load users from {}: {}",
matches.value_of("load").unwrap() matches.value_of("load").unwrap(),
error,
); );
} else {
tracing::info!("loaded users from {}", matches.value_of("load").unwrap());
} }
return Ok(()); return Ok(());
} else { } else {