Skip to content

Commit 6e90263

Browse files
committed
fix(bigquery): translate IOException to BigQueryException in runWithRetries to enable retries on HTTP errors
1 parent fb49fb8 commit 6e90263

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryRetryHelper.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,19 @@ public static <V> V runWithRetries(
6969
// implementation does not use response at all, so ignoring its type is ok.
7070
@SuppressWarnings("unchecked")
7171
ResultRetryAlgorithm<V> algorithm = (ResultRetryAlgorithm<V>) resultRetryAlgorithm;
72+
Callable<V> translatingCallable =
73+
new Callable<V>() {
74+
@Override
75+
public V call() throws Exception {
76+
try {
77+
return callable.call();
78+
} catch (IOException e) {
79+
throw new BigQueryException(e);
80+
}
81+
}
82+
};
7283
return run(
73-
callable,
84+
translatingCallable,
7485
new ExponentialRetryAlgorithm(retrySettings, clock),
7586
algorithm,
7687
bigQueryRetryConfig);

0 commit comments

Comments
 (0)