Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit-CloudSufi committed Jan 21, 2025
1 parent e8b7cd6 commit e0c7a9b
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,32 +156,26 @@ public void run(ActionContext context) throws Exception {
if (config.getRetryOnBackendError()) {
try {
executeQueryWithExponentialBackoff(bigQuery, queryConfig, context);
} catch (Exception e) {
} catch (Throwable e) {
String error = String.format(
"Failed to execute query with exponential backoff with message: %s", e.getMessage());
throw GCPErrorDetailsProviderUtil.getHttpResponseExceptionDetailsFromChain(e, error, ErrorType.USER,
true, GCPUtils.BQ_SUPPORTED_DOC_URL);
throw GCPErrorDetailsProviderUtil.getHttpResponseExceptionDetailsFromChain(new RuntimeException(e), error,
ErrorType.USER, true, GCPUtils.BQ_SUPPORTED_DOC_URL);
}
} else {
executeQuery(bigQuery, queryConfig, context);
}
}

void executeQueryWithExponentialBackoff(BigQuery bigQuery,
QueryJobConfiguration queryConfig, ActionContext context) {
QueryJobConfiguration queryConfig, ActionContext context) throws Throwable {
try {
Failsafe.with(getRetryPolicy()).run(() -> executeQuery(bigQuery, queryConfig, context));
} catch (FailsafeException e) {
if (e.getCause() != null) {
String error = String.format(
"Failed to execute query with exponential backoff with cause: %s.", e.getCause());
throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
error, error, ErrorType.USER, false, e);
throw e.getCause();
}
String error = String.format(
"Failed to execute query with exponential backoff with message: %s.", e.getMessage());
throw GCPErrorDetailsProviderUtil.getHttpResponseExceptionDetailsFromChain(e, error, ErrorType.USER,
true, GCPUtils.BQ_SUPPORTED_DOC_URL);
throw e;
}
}

Expand Down Expand Up @@ -214,7 +208,7 @@ private void executeQuery(BigQuery bigQuery, QueryJobConfiguration queryConfig,
} catch (BigQueryException e) {
LOG.error("The query job {} failed. Error: {}", jobId.getJob(), e.getError().getMessage());
if (RETRY_ON_REASON.contains(e.getError().getReason())) {
throw new BigQueryJobExecutionException(e.getError().getMessage());
throw new BigQueryJobExecutionException(e.getError().getMessage(), e);
}
String error = String.format("Failed to execute query with message: %s", e.getMessage());
throw GCPErrorDetailsProviderUtil.getHttpResponseExceptionDetailsFromChain(e, error, ErrorType.UNKNOWN,
Expand Down

0 comments on commit e0c7a9b

Please sign in to comment.