From e226252545f676d8198b272b2b77dc7a90ea7409 Mon Sep 17 00:00:00 2001 From: Rajat Bhatta Date: Sat, 5 Mar 2022 07:00:52 +0000 Subject: [PATCH] fix: catch ExecutionException for op.getName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../java/com/google/cloud/spanner/it/slow/ITBackupTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java index c17d34e64e0..bf65f7147ab 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java @@ -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. }