Skip to content

Commit

Permalink
Wrap oce in TaskCanceledException
Browse files Browse the repository at this point in the history
  • Loading branch information
lewing committed Jun 16, 2021
1 parent 00024ea commit 4974cb7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ public async Task ConnectAsync(Uri uri, CancellationToken cancellationToken, Cli

switch (exc) {
case WebSocketException:
case OperationCanceledException _ when cancellationToken.IsCancellationRequested:
throw;
case OperationCanceledException oce when cancellationToken.IsCancellationRequested:
throw new TaskCanceledException(oce.Message, oce.InnerException, cancellationToken);
default:
throw new WebSocketException(WebSocketError.Faulted, SR.net_webstatus_ConnectFailure, exc);
}
Expand Down

0 comments on commit 4974cb7

Please sign in to comment.