Skip to content

Commit 9880083

Browse files
committed
fix: Add received command to exception
1 parent 3f0577a commit 9880083

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/myactuator_rmd/protocol/single_motor_message.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#include <array>
1414
#include <cstdint>
15+
#include <ios>
16+
#include <sstream>
1517

1618
#include "myactuator_rmd/protocol/command_type.hpp"
1719
#include "myactuator_rmd/protocol/message.hpp"
@@ -49,7 +51,9 @@ namespace myactuator_rmd {
4951
constexpr SingleMotorMessage<C>::SingleMotorMessage(std::array<std::uint8_t,8> const& data)
5052
: Message{data} {
5153
if (data[0] != C) {
52-
throw ProtocolException("Unexpected response");
54+
std::stringstream ss {};
55+
ss << std::showbase << std::hex << static_cast<std::uint16_t>(data[0]);
56+
throw ProtocolException("Unexpected response '" + ss.str() + "'");
5357
}
5458
return;
5559
}

0 commit comments

Comments
 (0)