Skip to content

Commit d62f302

Browse files
Copilotdr1rrb
andcommitted
fix: Combine IOException and WebSocketException handlers
Co-authored-by: dr1rrb <8635919+dr1rrb@users.noreply.github.com>
1 parent 258ee99 commit d62f302

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

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

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -70,41 +70,6 @@ public static class WebSocketHelper
7070
}
7171
}
7272
}
73-
catch (IOException ex)
74-
{
75-
#if IS_DEVSERVER
76-
var log = Uno.Extensions.LogExtensionPoint.Log(typeof(Frame));
77-
if (log.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
78-
{
79-
ex.ToString();
80-
Microsoft.Extensions.Logging.LoggerExtensions.LogDebug(log, "Connection reset by peer.");
81-
}
82-
#else // Client
83-
var log = Uno.Foundation.Logging.LogExtensionPoint.Log(typeof(Frame));
84-
if (log.IsEnabled(Uno.Foundation.Logging.LogLevel.Debug))
85-
{
86-
log.LogDebug("Connection reset by peer.", ex);
87-
}
88-
#endif
89-
return null; // Connection reset by peer, no need to report this.
90-
}
91-
catch (WebSocketException ex)
92-
{
93-
#if IS_DEVSERVER
94-
var log = Uno.Extensions.LogExtensionPoint.Log(typeof(Frame));
95-
if (log.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information))
96-
{
97-
ex.ToString();
98-
Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(log, "WebSocket connection closed.");
99-
}
100-
#else // Client
101-
var log = Uno.Foundation.Logging.LogExtensionPoint.Log(typeof(Frame));
102-
if (log.IsEnabled(Uno.Foundation.Logging.LogLevel.Information))
103-
{
104-
log.LogInfo("WebSocket connection closed.", ex);
105-
}
106-
#endif
107-
return null; // WebSocket closed, no need to report this as an error.
10873
catch (Exception ex) when (ex is IOException or WebSocketException)
10974
{
11075
#if IS_DEVSERVER
@@ -117,7 +82,7 @@ public static class WebSocketHelper
11782
var log = Uno.Foundation.Logging.LogExtensionPoint.Log(typeof(Frame));
11883
if (log.IsEnabled(Uno.Foundation.Logging.LogLevel.Information))
11984
{
120-
log.LogInformation("Connection reset by peer.", ex);
85+
log.LogInfo("Connection reset by peer.", ex);
12186
}
12287
#endif
12388
return null; // Connection reset by peer, no need to report this.

0 commit comments

Comments
 (0)