Skip to content

Commit

Permalink
Handle exceptions whicha re thrown while processing application messa…
Browse files Browse the repository at this point in the history
…ges.
  • Loading branch information
chkr1011 committed Jul 28, 2017
1 parent d67b4a0 commit e021d5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion MQTTnet.Core/Client/MqttClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,15 @@ private void FireApplicationMessageReceivedEvent(MqttPublishPacket publishPacket
}

var applicationMessage = publishPacket.ToApplicationMessage();
ApplicationMessageReceived?.Invoke(this, new MqttApplicationMessageReceivedEventArgs(applicationMessage));

try
{
ApplicationMessageReceived?.Invoke(this, new MqttApplicationMessageReceivedEventArgs(applicationMessage));
}
catch (Exception exception)
{
MqttTrace.Error(nameof(MqttClient), exception, "Unhandled exception while handling application message.");
}
}

private Task ProcessReceivedPublishPacket(MqttPublishPacket publishPacket)
Expand Down

0 comments on commit e021d5a

Please sign in to comment.