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

@@ -56,7 +56,7 @@ impl Controller {
Ok(rmp_serde::from_slice(input)?)
}
// return the OG message for further processing
pub fn handle(&mut self, input: &[u8]) -> anyhow::Result<(Vec<u8>, ControlMessage)> {
pub fn handle(&mut self, input: &[u8]) -> anyhow::Result<(ControlMessage, ControlResponse)> {
let msg_nonce = self.parse_msg_no_nonce(input)?;
let msg = msg_nonce.0;
// nonce must be higher each time
@@ -110,8 +110,7 @@ impl Controller {
ControlResponse::OtaConfirm(params)
}
};
let response = self.build_response(res)?;
Ok((response, msg))
Ok((msg, res))
}
}