瀏覽代碼

Handle exceptions whicha re thrown while processing application messages.

release/3.x.x
Christian Kratky 7 年之前
父節點
當前提交
e021d5a56b
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. +9
    -1
      MQTTnet.Core/Client/MqttClient.cs

+ 9
- 1
MQTTnet.Core/Client/MqttClient.cs 查看文件

@@ -238,7 +238,15 @@ namespace MQTTnet.Core.Client
}

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)


Loading…
取消
儲存