From b74fd18afcd982d983142652f103c1731489795d Mon Sep 17 00:00:00 2001 From: scilio Date: Fri, 1 Jul 2022 05:47:42 -0400 Subject: [PATCH] more informative error for config file missing --- src/config.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index c068cd4..16f7085 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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 { - 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()))?;