Give more context to errors in improv packet handling
This commit is contained in:
parent
62c4e16445
commit
6fd28effe5
@ -371,7 +371,7 @@ impl ImprovDataFromPacket for RPCResultPacket {
|
|||||||
|
|
||||||
// load string and append to results
|
// load string and append to results
|
||||||
let string_bytes = &raw_packet.data[current_string_begin..current_string_end+1];
|
let string_bytes = &raw_packet.data[current_string_begin..current_string_end+1];
|
||||||
let string = std::str::from_utf8(string_bytes).unwrap().to_string();
|
let string = std::str::from_utf8(string_bytes).context("Failed to convert response to UTF-8 string")?.to_string();
|
||||||
results.push(string);
|
results.push(string);
|
||||||
|
|
||||||
// next data position
|
// next data position
|
||||||
@ -379,7 +379,7 @@ impl ImprovDataFromPacket for RPCResultPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Ok(Self {
|
return Ok(Self {
|
||||||
command_responded_to: RPCCommand::try_from(&raw_packet.data[0]).unwrap(),
|
command_responded_to: RPCCommand::try_from(&raw_packet.data[0]).context("Failed to determine RPC command this packet responds to")?,
|
||||||
results: results,
|
results: results,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user