Skip to content

Commit 1fa07aa

Browse files
committed
refactor(bigtable-snippets): shorten NotFoundException catch blocks in samples and tests
1 parent 49b34b4 commit 1fa07aa

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

java-bigtable/samples/snippets/src/main/java/com/example/bigtable/AuthorizedViewExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private boolean exists(String tableId) {
9999
.setView(Table.View.NAME_ONLY)
100100
.build());
101101
return true;
102-
} catch (com.google.api.gax.rpc.NotFoundException e) {
102+
} catch (NotFoundException e) {
103103
return false;
104104
}
105105
}

java-bigtable/samples/snippets/src/main/java/com/example/bigtable/InstanceAdminExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void createProdInstance(boolean createWithTags) {
123123
.setName("projects/" + projectId + "/instances/" + instanceId)
124124
.build());
125125
exists = true;
126-
} catch (com.google.api.gax.rpc.NotFoundException e) {
126+
} catch (NotFoundException e) {
127127
// ignore
128128
}
129129
if (!exists) {

java-bigtable/samples/snippets/src/main/java/com/example/bigtable/SchemaBundleExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private boolean exists(String tableId) {
9595
.setView(Table.View.NAME_ONLY)
9696
.build());
9797
return true;
98-
} catch (com.google.api.gax.rpc.NotFoundException e) {
98+
} catch (NotFoundException e) {
9999
return false;
100100
}
101101
}

java-bigtable/samples/snippets/src/test/java/com/example/bigtable/TableAdminExampleTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private static boolean exists(String tableId) {
6363
.setView(Table.View.NAME_ONLY)
6464
.build());
6565
return true;
66-
} catch (com.google.api.gax.rpc.NotFoundException e) {
66+
} catch (NotFoundException e) {
6767
return false;
6868
}
6969
}

0 commit comments

Comments
 (0)