Better error message when config not found
This commit is contained in:
@@ -21,8 +21,12 @@ pub fn read_config(path: &str) -> Result<Config, String> {
|
|||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"Error reading configuration file \"{}\": {}",
|
"Error reading configuration file \"{}\": {}",
|
||||||
path, e
|
path,
|
||||||
))
|
match e.kind() {
|
||||||
|
std::io::ErrorKind::NotFound => String::from("not found"),
|
||||||
|
_ => e.to_string(),
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![feature(io_error_more)]
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|||||||
Reference in New Issue
Block a user