Skip to content

Commit

Permalink
fix: Add received command to exception
Browse files Browse the repository at this point in the history
  • Loading branch information
2b-t committed Jun 14, 2024
1 parent 3f0577a commit 9880083
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/myactuator_rmd/protocol/single_motor_message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <array>
#include <cstdint>
#include <ios>
#include <sstream>

#include "myactuator_rmd/protocol/command_type.hpp"
#include "myactuator_rmd/protocol/message.hpp"
Expand Down Expand Up @@ -49,7 +51,9 @@ namespace myactuator_rmd {
constexpr SingleMotorMessage<C>::SingleMotorMessage(std::array<std::uint8_t,8> const& data)
: Message{data} {
if (data[0] != C) {
throw ProtocolException("Unexpected response");
std::stringstream ss {};
ss << std::showbase << std::hex << static_cast<std::uint16_t>(data[0]);
throw ProtocolException("Unexpected response '" + ss.str() + "'");
}
return;
}
Expand Down

0 comments on commit 9880083

Please sign in to comment.