Skip to content

Commit

Permalink
unit test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit-CloudSufi committed Jan 27, 2025
1 parent 4975d27 commit c682a83
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ public void run(ActionContext context) {
// Check for errors
if (queryJob.getStatus().getError() != null) {
String error = queryJob.getStatus().getExecutionErrors().toString();
throw BigQueryErrorUtil.getProgramFailureException(error,
queryJob.getStatus().getError().getReason(), null);
ErrorType type = BigQueryErrorUtil.getErrorType(queryJob.getStatus().getError().getReason());
throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
error, error, type, true, null);
}
TableResult queryResults;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ public void run(ActionContext context) {
}
}

private void executeQueryWithExponentialBackoff(BigQuery bigQuery,
QueryJobConfiguration queryConfig, ActionContext context) {
protected void executeQueryWithExponentialBackoff(BigQuery bigQuery,
QueryJobConfiguration queryConfig, ActionContext context) {
try {
Failsafe.with(getRetryPolicy()).run(() -> executeQuery(bigQuery, queryConfig, context));
} catch (FailsafeException e) {
Expand Down Expand Up @@ -262,8 +262,10 @@ private void executeQuery(BigQuery bigQuery, QueryJobConfiguration queryConfig,
String error = String.format("Failed to execute query with reason: %s and message: %s",
queryJob.getStatus().getError().getReason(),
queryJob.getStatus().getError().getMessage());
throw BigQueryErrorUtil.getProgramFailureException(error,
queryJob.getStatus().getError().getReason(), null);
ErrorType type = BigQueryErrorUtil.getErrorType(queryJob.getStatus().getError().getReason());
throw ErrorUtils.getProgramFailureException(
new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), error, error, type, true,
null);
}

TableResult queryResults;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class BigQueryErrorUtil {
* @param errorReason the error reason to classify
* @return the corresponding ErrorType (USER, SYSTEM, UNKNOWN)
*/
private static ErrorType getErrorType(String errorReason) {
public static ErrorType getErrorType(String errorReason) {
if (errorReason != null && ERROR_REASON_TO_ERROR_TYPE.containsKey(errorReason)) {
return ERROR_REASON_TO_ERROR_TYPE.get(errorReason);
}
Expand Down

0 comments on commit c682a83

Please sign in to comment.