Skip to content

Commit

Permalink
Improve 'wrong device' error message with expected and actual serial (#…
Browse files Browse the repository at this point in the history
…16)

Co-authored-by: juanlu <jgo@qwello.eu>
  • Loading branch information
ju4nlu and juanlu authored Feb 22, 2024
1 parent 843ecf4 commit dcd6214
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zvt_feig_terminal/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ mod outer {
debug!("Received {packet:?}");
match packet? {
feig::sequences::GetSystemInfoResponse::CVendFunctionsEnhancedSystemInformationCompletion(packet) => {
if packet.device_id.to_lowercase() == config.feig_serial.to_lowercase() {
let expected_serial: String = config.feig_serial.to_lowercase();
let actual_serial: String = packet.device_id.to_lowercase();
if actual_serial == expected_serial {
drop(stream);
return Ok(socket);
}
bail!(Error::new(ErrorKind::NotConnected, "Wrong device"))
bail!(Error::new(ErrorKind::NotConnected, format!("Wrong device. Expected {}, got {}", expected_serial, actual_serial)))
},
feig::sequences::GetSystemInfoResponse::Abort(packet) => bail!(zvt::ZVTError::Aborted(packet.error))
}
Expand Down

0 comments on commit dcd6214

Please sign in to comment.