Better error message when config not found

This commit is contained in:
2021-11-29 00:24:27 +01:00
parent e43d4bf3cd
commit f5f8dfa188
2 changed files with 8 additions and 2 deletions

View File

@@ -21,8 +21,12 @@ pub fn read_config(path: &str) -> Result<Config, String> {
Err(e) => {
return Err(format!(
"Error reading configuration file \"{}\": {}",
path, e
))
path,
match e.kind() {
std::io::ErrorKind::NotFound => String::from("not found"),
_ => e.to_string(),
}
));
}
};

View File

@@ -1,3 +1,5 @@
#![feature(io_error_more)]
use std::fs;
use std::path::{Path, PathBuf};
use std::process;