Skip to content

Commit

Permalink
Stop wrapping OperationCancellationException with DbUpdateException
Browse files Browse the repository at this point in the history
Fixes #15074
  • Loading branch information
roji committed Aug 20, 2021
1 parent 8ee0305 commit 83fe4d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected override void Consume(RelationalDataReader reader)
"Expected " + expectedResultSetCount + " result sets, got " + actualResultSetCount);
#endif
}
catch (Exception ex) when (!(ex is DbUpdateException))
catch (Exception ex) when (ex is not DbUpdateException and not OperationCanceledException)
{
throw new DbUpdateException(
RelationalStrings.UpdateStoreException,
Expand Down Expand Up @@ -150,7 +150,7 @@ protected override async Task ConsumeAsync(
"Expected " + expectedResultSetCount + " result sets, got " + actualResultSetCount);
#endif
}
catch (Exception ex) when (!(ex is DbUpdateException))
catch (Exception ex) when (ex is not DbUpdateException and not OperationCanceledException)
{
throw new DbUpdateException(
RelationalStrings.UpdateStoreException,
Expand Down
12 changes: 2 additions & 10 deletions src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,7 @@ public override void Execute(IRelationalConnection connection)
Dependencies.Logger, CommandSource.SaveChanges));
Consume(dataReader);
}
catch (DbUpdateException)
{
throw;
}
catch (Exception ex)
catch (Exception ex) when (ex is not DbUpdateException and not OperationCanceledException)
{
throw new DbUpdateException(
RelationalStrings.UpdateStoreException,
Expand Down Expand Up @@ -293,11 +289,7 @@ public override async Task ExecuteAsync(
cancellationToken).ConfigureAwait(false);
await ConsumeAsync(dataReader, cancellationToken).ConfigureAwait(false);
}
catch (DbUpdateException)
{
throw;
}
catch (Exception ex)
catch (Exception ex) when (ex is not DbUpdateException and not OperationCanceledException)
{
throw new DbUpdateException(
RelationalStrings.UpdateStoreException,
Expand Down

0 comments on commit 83fe4d6

Please sign in to comment.