From 042f7414c229d1c7f66aef24faa92defb91a78cf Mon Sep 17 00:00:00 2001 From: Till Hoeppner Date: Sun, 30 Nov 2014 17:51:24 +0100 Subject: Add minimal configuration --- src/sersve.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/sersve.rs') 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.") -- cgit v1.2.3