Skip to content

Commit

Permalink
Fix lost stack trace
Browse files Browse the repository at this point in the history
  • Loading branch information
psainics committed Dec 6, 2023
1 parent 5475c5b commit a090978
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ protected void executeQueryWithExponentialBackoff(BigQuery bigQuery,
try {
Failsafe.with(getRetryPolicy()).run(() -> executeQuery(bigQuery, queryConfig, context));
} catch (RuntimeException e) {
LOG.error("Failed to execute BigQuery job. Error: {}", e.getMessage());
throw new BigQueryJobExecutionException("Failed to execute BigQuery job. Reason: " + e.getMessage());
String errorMessage = "Failed to execute BigQuery job. Reason: " + e.getMessage();
LOG.error(errorMessage);
throw new BigQueryJobExecutionException(errorMessage, e);
}

}
Expand Down Expand Up @@ -188,7 +189,7 @@ private void executeQuery(BigQuery bigQuery, QueryJobConfiguration queryConfig,
} catch (BigQueryException e) {
LOG.error("The query job {} failed. Error: {}", jobId.getJob(), e.getMessage());
if (RETRY_ON_REASON.contains(e.getError().getReason())) {
throw new BigQueryJobExecutionException(e.getMessage());
throw new BigQueryJobExecutionException(e.getMessage(), e);
}
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ public class BigQueryJobExecutionException extends Exception {
public BigQueryJobExecutionException(String message) {
super(message);
}

public BigQueryJobExecutionException(String message, Throwable cause) {
super(message, cause);
}
}

0 comments on commit a090978

Please sign in to comment.