From 985d4d03e89ce906740517b216cd6df22082ff69 Mon Sep 17 00:00:00 2001 From: Lennart <18233294+lennart-k@users.noreply.github.com> Date: Wed, 15 Jan 2025 17:30:12 +0100 Subject: [PATCH] Improve error message when missing config file --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 71ad0b2..20617dc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -95,8 +95,9 @@ async fn main() -> Result<()> { Some(Command::Pwhash(pwhash_args)) => cmd_pwhash(pwhash_args)?, None => { let config: Config = toml::from_str( - &fs::read_to_string(&args.config_file) - .expect(&format!("No config file found at {}", &args.config_file)), + &fs::read_to_string(&args.config_file).unwrap_or_else(|err| { + panic!("Could not open file at {}: {}", &args.config_file, err) + }), )?; setup_tracing(&config.tracing);