Skip to content

Commit e4b0740

Browse files
authored
Merge pull request #21878 from unoplatform/copilot/fix-invalid-error-logs
fix: Suppress connection reset errors when client disconnects
2 parents 4aa962e + d62f302 commit e4b0740

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Uno.UI.RemoteControl/Helpers/WebSocketHelper.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,19 @@ public static class WebSocketHelper
7070
}
7171
}
7272
}
73-
catch (IOException ex)
73+
catch (Exception ex) when (ex is IOException or WebSocketException)
7474
{
7575
#if IS_DEVSERVER
7676
var log = Uno.Extensions.LogExtensionPoint.Log(typeof(Frame));
77-
if (log.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
77+
if (log.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information))
7878
{
79-
ex.ToString();
80-
Microsoft.Extensions.Logging.LoggerExtensions.LogDebug(log, "Connection reset by peer.");
79+
Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(log, "Connection reset by peer.");
8180
}
8281
#else // Client
8382
var log = Uno.Foundation.Logging.LogExtensionPoint.Log(typeof(Frame));
84-
if (log.IsEnabled(Uno.Foundation.Logging.LogLevel.Debug))
83+
if (log.IsEnabled(Uno.Foundation.Logging.LogLevel.Information))
8584
{
86-
log.LogDebug("Connection reset by peer.", ex);
85+
log.LogInfo("Connection reset by peer.", ex);
8786
}
8887
#endif
8988
return null; // Connection reset by peer, no need to report this.

0 commit comments

Comments
 (0)