From f3d219b34d44e0ecd8dbb1b17f067cd6255763a8 Mon Sep 17 00:00:00 2001 From: Lily Sturmann Date: Fri, 5 Aug 2022 11:29:22 -0400 Subject: [PATCH] Add more helpful error when config file is not found Signed-off-by: Lily Sturmann --- src/common.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common.rs b/src/common.rs index 3f7ed476..f803c108 100644 --- a/src/common.rs +++ b/src/common.rs @@ -297,7 +297,16 @@ pub(crate) struct KeylimeConfig { impl KeylimeConfig { pub fn build() -> Result { let conf_name = config_file_get(); - let conf = Ini::load_from_file(&conf_name)?; + let conf = match Ini::load_from_file(&conf_name) { + Ok(file) => file, + Err(e) => { + error!( + "Could not load keylime config file: {} due to error: {}", + conf_name, e + ); + return Err(Error::Ini(e)); + } + }; let agent_ip = config_get_env( &conf_name,