summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStuart Stock <stuart@int08h.com>2019-03-09 09:31:10 -0600
committerStuart Stock <stuart@int08h.com>2019-03-14 19:56:29 -0500
commit384194278089fe658fdb3b03032e5b63e6d81e3f (patch)
tree9e65c07201c7202d6ed600417854dde9165067f8 /src
parent6f27aae6f9b1f76285dae826caee8bf887202d6f (diff)
downloadroughenough-384194278089fe658fdb3b03032e5b63e6d81e3f.zip
Improve FileConfig's error messages
Diffstat (limited to 'src')
-rw-r--r--src/config/file.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/config/file.rs b/src/config/file.rs
index b71b610..0e69571 100644
--- a/src/config/file.rs
+++ b/src/config/file.rs
@@ -48,18 +48,20 @@ pub struct FileConfig {
impl FileConfig {
pub fn new(config_file: &str) -> Result<Self, Error> {
- let mut infile = File::open(config_file).expect("failed to open config file");
+ let mut infile = File::open(config_file)
+ .expect(&format!("failed to open config file '{}'", config_file));
let mut contents = String::new();
infile
.read_to_string(&mut contents)
- .expect("could not read config file");
+ .expect(&format!("could not read config file '{}'", config_file));
- let cfg = YamlLoader::load_from_str(&contents).expect("could not parse config file");
+ let cfg = YamlLoader::load_from_str(&contents)
+ .expect(&format!("could not parse config file '{}'", config_file));
if cfg.len() != 1 {
return Err(Error::InvalidConfiguration(
- "Empty or malformed config file".to_string(),
+ format!("Empty or malformed config file '{}'", config_file),
));
}
@@ -90,10 +92,9 @@ impl FileConfig {
config.status_interval = Duration::from_secs(val as u64)
}
"kms_protection" => {
- let val =
- value.as_str().unwrap().parse().unwrap_or_else(|_| {
- panic!("invalid kms_protection value: {:?}", value)
- });
+ let val = value.as_str().unwrap().parse().unwrap_or_else(|_| {
+ panic!("invalid kms_protection value: {:?}", value)
+ });
config.kms_protection = val
}
"health_check_port" => {