diff --git a/cli_helpers/src/lib.rs b/cli_helpers/src/lib.rs index a5f917d..9414854 100644 --- a/cli_helpers/src/lib.rs +++ b/cli_helpers/src/lib.rs @@ -64,11 +64,19 @@ fn run_inner( fn config_from_toml_file(path: String) -> anyhow::Result where T: DeserializeOwned { - let mut file = File::open(path)?; - let mut data = String::new(); - file.read_to_string(&mut data)?; + let mut file = File::open(path.clone()).with_context(|| + format!("Couldn't open config file {}", path.clone()) + )?; - toml::from_str(&data).context("Couldn't parse config file") + let mut data = String::new(); + + file.read_to_string(&mut data).with_context(|| + format!("Couldn't read config file {}", path.clone()) + )?; + + toml::from_str(&data).with_context(|| + format!("Couldn't parse config file {}", path.clone()) + ) }