File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
main/java/com/wepay/kafka/connect/bigquery/write/row
test/java/com/wepay/kafka/connect/bigquery/write/row Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ private boolean isTableMissingSchema(BigQueryException exception) {
81
81
private boolean isTableNotExistedException (BigQueryException exception ) {
82
82
// If a table does not exist, it will raise a BigQueryException that the input is notFound
83
83
// Referring to Google Cloud Error Codes Doc: https://cloud.google.com/bigquery/docs/error-messages?hl=en
84
- return exception .getReason () != null && exception . getReason (). equalsIgnoreCase ( "notFound" ) ;
84
+ return exception .getCode () == 404 ;
85
85
}
86
86
87
87
/**
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ public void testAutoCreateTables() {
117
117
when (insertAllResponse .getInsertErrors ()).thenReturn (emptyMap );
118
118
119
119
BigQueryException missTableException = mock (BigQueryException .class );
120
- when (missTableException .getReason ()).thenReturn ("notFound" );
120
+ when (missTableException .getCode ()).thenReturn (404 );
121
121
122
122
when (bigQuery .insertAll (anyObject ())).thenThrow (missTableException ).thenReturn (insertAllResponse );
123
123
@@ -152,7 +152,7 @@ public void testNonAutoCreateTables() {
152
152
when (insertAllResponse .getInsertErrors ()).thenReturn (emptyMap );
153
153
154
154
BigQueryException missTableException = mock (BigQueryException .class );
155
- when (missTableException .getReason ()).thenReturn ("notFound" );
155
+ when (missTableException .getCode ()).thenReturn (404 );
156
156
157
157
when (bigQuery .insertAll (anyObject ())).thenThrow (missTableException ).thenReturn (insertAllResponse );
158
158
You can’t perform that action at this time.
0 commit comments