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 <manos.pitsidianakis@linaro.org>
Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
This commit is contained in:
Erik Schilling 2023-07-10 08:17:02 +02:00 committed by Viresh Kumar
parent a9de87a1ce
commit 3cab62ea02

View File

@ -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);
}