This commit is contained in:
Nav
2024-12-08 23:33:39 +00:00
parent c15eba5ca9
commit a971e92a58
2 changed files with 26 additions and 8 deletions

View File

@@ -56,6 +56,7 @@ namespace DebugToolDrivers::Wch::Protocols::WchLink
template <class CommandType>
auto sendCommandAndWaitForResponse(const CommandType& command) {
using Services::StringService;
const auto rawCommand = command.getRawCommand();
/*
@@ -86,14 +87,15 @@ namespace DebugToolDrivers::Wch::Protocols::WchLink
}
if (rawResponse[0] == 0x81) {
throw Exceptions::DeviceCommunicationFailure{"Error response"};
throw Exceptions::DeviceCommunicationFailure{
"Error response to command 0x" + StringService::toHex(command.commandId)
};
}
if (rawResponse[1] != command.commandId) {
throw Exceptions::DeviceCommunicationFailure{
"Missing/invalid command ID in response from device 0x"
+ Services::StringService::toHex(rawResponse[1]) + " - expected: 0x"
+ Services::StringService::toHex(command.commandId)
"Missing/invalid command ID in response from device 0x" + StringService::toHex(rawResponse[1])
+ " - expected: 0x" + StringService::toHex(command.commandId)
};
}