Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more helpful error when config file is not found #436

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,16 @@ pub(crate) struct KeylimeConfig {
impl KeylimeConfig {
pub fn build() -> Result<Self> {
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,
Expand Down