Skip to content

Commit b45bba6

Browse files
Added exception unwinding and logging on MqttRelay module when connection error throws
1 parent 5868596 commit b45bba6

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • agent/Modules/MTConnect.NET-AgentModule-MqttRelay

agent/Modules/MTConnect.NET-AgentModule-MqttRelay/Module.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,20 @@ private async Task Worker()
216216
}
217217
catch (Exception ex)
218218
{
219+
219220
Log(MTConnectLogLevel.Warning, $"MQTT Relay Connection Error : {ex.Message}");
221+
222+
var current = current.InnerException;
223+
224+
while( current != null )
225+
{
226+
Log(MTConnectLogLevel.Warning, $"MQTT Relay Connection Error (InnerException) : {current.Message}");
227+
current = current.InnerException;
228+
}
229+
230+
Log(MTConnectLogLevel.Warning, $"MQTT Relay Connection Error (BaseException) : {ex.GetBaseException().ToString()}");
231+
232+
220233
}
221234
finally
222235
{

0 commit comments

Comments
 (0)