diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sersve.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/sersve.rs b/src/sersve.rs index ebc4636..e7e39e2 100644 --- a/src/sersve.rs +++ b/src/sersve.rs @@ -217,6 +217,8 @@ fn main() { matches.opt_str("c").map(|conf_file| { let conf_file = File::open(&Path::new(conf_file)); conf_file.as_ref().map_err::<()>(|e| panic!("{}", e.desc)).unwrap(); + + // cannot if-let, because typesafe errors are helpful let json = match json::from_reader(&mut conf_file.ok().unwrap()) { Ok(Json::Object(o)) => o, _ => panic!("Invalid configuration file. Doesn't contain top-level object.") |