Skip to content

Commit 3234b7c

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

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,16 @@ 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+
() -> {
74+
try {
75+
return callable.call();
76+
} catch (IOException e) {
77+
throw new BigQueryException(e);
78+
}
79+
};
7280
return run(
73-
callable,
81+
translatingCallable,
7482
new ExponentialRetryAlgorithm(retrySettings, clock),
7583
algorithm,
7684
bigQueryRetryConfig);

0 commit comments

Comments
 (0)