mirror of
https://github.com/mimblewimble/mwixnet.git
synced 2025-01-20 19:11:09 +03:00
more informative error for config file missing
This commit is contained in:
parent
2baf37a5a3
commit
b74fd18afc
1 changed files with 6 additions and 1 deletions
|
@ -168,7 +168,12 @@ pub fn write_config(
|
|||
|
||||
/// Reads the server config from the config_path given and decrypts it with the provided password.
|
||||
pub fn load_config(config_path: &PathBuf, password: &ZeroingString) -> Result<ServerConfig> {
|
||||
let contents = std::fs::read_to_string(config_path)?;
|
||||
let contents = std::fs::read_to_string(config_path).map_err(|e| {
|
||||
error::ErrorKind::LoadConfigError(format!(
|
||||
"Unable to read server config. Perform init-config or pass in config path.\nError: {}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
let raw_config: RawConfig =
|
||||
toml::from_str(&contents).map_err(|e| error::ErrorKind::LoadConfigError(e.to_string()))?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue