Browse Source

fix: Stop TaskCanceledException from bubbling up (#1580)

tags/2.3.0
Paulo GitHub 4 years ago
parent
commit
b8fa464125
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      src/Discord.Net.WebSocket/ConnectionManager.cs

+ 10
- 1
src/Discord.Net.WebSocket/ConnectionManager.cs View File

@@ -141,7 +141,16 @@ namespace Discord
catch (OperationCanceledException) { }
});

await _onConnecting().ConfigureAwait(false);
try
{
await _onConnecting().ConfigureAwait(false);
}
catch (TaskCanceledException ex)
{
Exception innerEx = ex.InnerException ?? new OperationCanceledException("Failed to connect.");
Error(innerEx);
throw innerEx;
}

await _logger.InfoAsync("Connected").ConfigureAwait(false);
State = ConnectionState.Connected;


Loading…
Cancel
Save