Skip to content

Commit

Permalink
fix: catch ExecutionException for op.getName
Browse files Browse the repository at this point in the history
Following exception is thrown:

java.util.concurrent.ExecutionException: com.google.api.gax.rpc.FailedPreconditionException: io.grpc.StatusRuntimeException: FAILED_PRECONDITION.

So, changing the catch to catch ExecutionException as well.

Catch both SpannerException and ExecutionException.

Co-authored-by: Knut Olav Løite <[email protected]>
  • Loading branch information
rajatbhatta and olavloite committed Mar 5, 2022
1 parent bc734ce commit e226252
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public void test02_RetryNonIdempotentRpcsReturningLongRunningOperations() throws
}
try {
client.cancelOperation(op.getName());
} catch (SpannerException e) {
} catch (SpannerException | ExecutionException e) {
// Ignore, this can happen, as the restore operation sometimes fails to start if there
// is already a restore operation running on the instance.
}
Expand Down

0 comments on commit e226252

Please sign in to comment.