comparison rust/src/config.rs @ 636:43eb3cfdf769 rust

some progress, better error handling
author Matt Johnston <matt@ucc.asn.au>
date Wed, 16 Oct 2019 22:33:06 +0800
parents 4424a8b30f9c
children 89818a14648b
comparison
equal deleted inserted replaced
635:4424a8b30f9c 636:43eb3cfdf769
41 config::ConfigError::NotFound(_) => TemplogError::new(&format!("Missing config {}", conf_file)), 41 config::ConfigError::NotFound(_) => TemplogError::new(&format!("Missing config {}", conf_file)),
42 _ => TemplogError::new(&format!("Problem parsing {}: {}", conf_file, e)), 42 _ => TemplogError::new(&format!("Problem parsing {}: {}", conf_file, e)),
43 }) 43 })
44 })?; 44 })?;
45 c.merge(config::Environment::with_prefix("TEMPLOG")).unwrap(); 45 c.merge(config::Environment::with_prefix("TEMPLOG")).unwrap();
46 println!("c is {:?}", c); 46 c.try_into().or_else(|e| Err(TemplogError::new(&format!("Problem loading config {}: {}", conf_file, e))))
47 Ok(c.try_into().unwrap())
48 } 47 }
49 } 48 }