Browse Source

Stop TaskCanceledException from bubbling up

pull/1580/head
SubZero0 5 years ago
parent
commit
14c02e001e
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) { } 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); await _logger.InfoAsync("Connected").ConfigureAwait(false);
State = ConnectionState.Connected; State = ConnectionState.Connected;


Loading…
Cancel
Save