mirror of
https://github.com/ViViDboarder/bitwarden_rs_ldap.git
synced 2024-11-21 18:56:27 +00:00
More descriptive errors when failing to parse a config file
This commit is contained in:
parent
94d82a827f
commit
96d7483d31
@ -37,9 +37,9 @@ pub fn read_config_from_file() -> Result<Config, String> {
|
||||
let config_path = get_config_path();
|
||||
|
||||
let contents = fs::read_to_string(&config_path)
|
||||
.map_err(|_| format!("Failed to open config file at {}", config_path))?;
|
||||
.map_err(|err| format!("Failed to open config file at {}: {}", config_path, err))?;
|
||||
let config: Config = toml::from_str(contents.as_str())
|
||||
.map_err(|_| format!("Failed to parse config file at {}", config_path))?;
|
||||
.map_err(|err| format!("Failed to parse config file at {}: {}", config_path, err))?;
|
||||
|
||||
println!("Config read from file at {}", config_path);
|
||||
Ok(config)
|
||||
|
Loading…
Reference in New Issue
Block a user