From 3cab62ea02fd554981bd555455c1cedf409743b2 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Mon, 10 Jul 2023 08:17:02 +0200 Subject: [PATCH] rng: also pretty print configuration errors If the parsed commandline options cannot be converted into a `VuRngConfig` we would only get a .unwrap() error message. Chain this before the check of the daemon launch. Suggested-by: Manos Pitsidianakis Signed-off-by: Erik Schilling --- crates/rng/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rng/src/main.rs b/crates/rng/src/main.rs index dc9d666..a1767a7 100644 --- a/crates/rng/src/main.rs +++ b/crates/rng/src/main.rs @@ -170,7 +170,7 @@ pub(crate) fn start_backend(config: VuRngConfig) -> Result<()> { fn main() { env_logger::init(); - if let Err(e) = start_backend(VuRngConfig::try_from(RngArgs::parse()).unwrap()) { + if let Err(e) = VuRngConfig::try_from(RngArgs::parse()).and_then(start_backend) { error!("{e}"); exit(1); }