Skip to content

Commit

Permalink
Use string of reason code in connack failure
Browse files Browse the repository at this point in the history
  • Loading branch information
halfgaar committed May 20, 2024
1 parent bdb47e5 commit 5a61fca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mqttpacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,8 @@ void MqttPacket::handleConnAck()

if (data.reasonCode != ReasonCodes::Success)
{
throw std::runtime_error(formatString("Client '%s' connection failed. Reason code: %d", sender->repr().c_str(), data.reasonCode));
const std::string err = "Client '" + sender->repr() + "' connection failed. Reason: " + reasonCodeToString(data.reasonCode) ;
throw std::runtime_error(err);
}

if (!settings->allowUnsafeClientidChars && containsDangerousCharacters(data.assigned_client_id))
Expand Down

0 comments on commit 5a61fca

Please sign in to comment.