Mercurial > templog
changeset 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 | 1e147b3c2c55 |
files | rust/src/config.rs rust/src/fridge.rs rust/src/params.rs |
diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/src/config.rs Sun Sep 22 22:06:46 2019 +0800 +++ b/rust/src/config.rs Wed Oct 16 22:33:06 2019 +0800 @@ -43,7 +43,6 @@ }) })?; c.merge(config::Environment::with_prefix("TEMPLOG")).unwrap(); - println!("c is {:?}", c); - Ok(c.try_into().unwrap()) + c.try_into().or_else(|e| Err(TemplogError::new(&format!("Problem loading config {}: {}", conf_file, e)))) } }
--- a/rust/src/fridge.rs Sun Sep 22 22:06:46 2019 +0800 +++ b/rust/src/fridge.rs Wed Oct 16 22:33:06 2019 +0800 @@ -171,6 +171,7 @@ FridgeControl::Fake => debug!("fridge turns {}", if on {"on"} else {"off"}), } self.on = on; + self.integrator.turn(on) } // Turns the fridge off and on
--- a/rust/src/params.rs Sun Sep 22 22:06:46 2019 +0800 +++ b/rust/src/params.rs Wed Oct 16 22:33:06 2019 +0800 @@ -19,8 +19,6 @@ // for try_concat() use futures::stream::TryStreamExt; use futures::executor::block_on; -// for block_on().or_else -use futures_util::try_future::TryFutureExt; use riker::actors::*; @@ -181,7 +179,9 @@ ctx.schedule_once(Duration::from_secs(1), ctx.myself(), None, PollForParams); if let Err(e) = self.do_poll(ctx) { - warn!("Problem fetching params: {}", e); + self.limitlog.and_then(|| { + warn!("Problem fetching params: {}", e) + }); } }