commit b27bdc552bcb53edbbd666a5322f49f595efd98d
parent 0c65524b13273cc1a35bd893177d32aa25c230d5
Author: Ryan Jeffrey <ryan@ryanmj.xyz>
Date: Wed, 8 Jun 2022 19:17:34 -0700
Better error messages
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/config.rs b/src/config.rs
@@ -104,11 +104,17 @@ impl Config {
// Keep the data we want to survive the assignment.
let config_file_path = self.config_file_path.clone();
let cache_path = self.cache_path.clone();
+ // TODO get ~ in paths to expand
*self = match toml::from_str(&match fs::read_to_string(Path::new(&config_file_path)) {
- Err(e) => return Err(format!("{}", e)),
+ Err(e) => return Err(format!("Could not read {}, {}", config_file_path, e)),
Ok(r) => r,
}) {
- Err(e) => return Err(format!("{}", e)),
+ Err(e) => {
+ return Err(format!(
+ "Could not parse config file {}, {}",
+ config_file_path, e
+ ))
+ }
Ok(r) => r,
};