Browse Source

Cleaned up websocket exceptions

tags/docs-0.9
RogueException 9 years ago
parent
commit
31bea1a394
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      src/Discord.Net/Net/WebSockets/WS4NetEngine.cs

+ 7
- 1
src/Discord.Net/Net/WebSockets/WS4NetEngine.cs View File

@@ -83,7 +83,13 @@ namespace Discord.Net.WebSockets
{
Exception ex;
if (e is ClosedEventArgs)
ex = new Exception($"Received close code {(e as ClosedEventArgs).Code}: {(e as ClosedEventArgs).Reason ?? "No reason"}");
{
int code = (e as ClosedEventArgs).Code;
string reason = (e as ClosedEventArgs).Reason;
if (String.IsNullOrEmpty(reason))
reason = "No reason";
ex = new Exception($"Received close code {code}: {reason}");
}
else
ex = new Exception($"Connection lost");
_taskManager.SignalError(ex, isUnexpected: true);


Loading…
Cancel
Save