propagate errors to user in handle_control_response

This commit is contained in:
decentclock
2022-09-24 12:26:31 -04:00
parent 0002374a7f
commit f208a5af5e
4 changed files with 30 additions and 22 deletions

View File

@@ -101,13 +101,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
}
topics::CONTROL => {
match ctrlr.handle(&msg_bytes) {
Ok((response, _new_policy)) => {
Ok((_msg, res)) => {
let res_data = rmp_serde::to_vec(&res).expect("could not publish control response");
client
.publish(
topics::CONTROL_RETURN,
QoS::AtMostOnce,
false,
response,
res_data,
)
.await
.expect("could not mqtt publish");
@@ -158,13 +159,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
}
topics::CONTROL => {
match ctrlr.handle(&msg_bytes) {
Ok((response, _new_policy)) => {
Ok((_msg, res)) => {
let res_data = rmp_serde::to_vec(&res).expect("could not publish control response");
client
.publish(
topics::CONTROL_RETURN,
QoS::AtMostOnce,
false,
response,
res_data,
)
.await
.expect("could not mqtt publish");