Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit-CloudSufi committed Jan 17, 2025
1 parent 8cc63e6 commit 7c6135e
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import io.cdap.plugin.gcp.bigquery.sink.BigQuerySinkUtils;
import io.cdap.plugin.gcp.bigquery.util.BigQueryUtil;
import io.cdap.plugin.gcp.common.CmekUtils;
import io.cdap.plugin.gcp.common.GCPErrorDetailsProviderUtil;
import io.cdap.plugin.gcp.common.GCPUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -158,8 +159,8 @@ public void run(ActionContext context) throws Exception {
} catch (Exception e) {
String error = String.format(
"Failed to execute query with exponential backoff with message: %s", e.getMessage());
throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
error, error, ErrorType.USER, false, e);
throw GCPErrorDetailsProviderUtil.getHttpResponseExceptionDetailsFromChain(e, error, ErrorType.USER,
true, GCPUtils.BQ_SUPPORTED_DOC_URL);
}
} else {
executeQuery(bigQuery, queryConfig, context);
Expand All @@ -179,8 +180,8 @@ void executeQueryWithExponentialBackoff(BigQuery bigQuery,
}
String error = String.format(
"Failed to execute query with exponential backoff with message: %s.", e.getMessage());
throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
error, error, ErrorType.USER, false, e);
throw GCPErrorDetailsProviderUtil.getHttpResponseExceptionDetailsFromChain(e, error, ErrorType.USER,
true, GCPUtils.BQ_SUPPORTED_DOC_URL);
}
}

Expand Down Expand Up @@ -213,16 +214,11 @@ 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())) {
String error = e.getError().getMessage();
throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
error, error, ErrorType.USER, false, new BigQueryJobExecutionException(error, e));
throw new BigQueryJobExecutionException(e.getError().getMessage());
}
String error = String.format("Failed to execute query with message: %s", e.getMessage());
// throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
// error, error, ErrorType.USER, false, null);
throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
error, error, ErrorType.USER, false, ErrorCodeType.OTHERS, String.valueOf(e.getCode()),
null, e);
throw GCPErrorDetailsProviderUtil.getHttpResponseExceptionDetailsFromChain(e, error, ErrorType.UNKNOWN,
true, GCPUtils.GCS_SUPPORTED_DOC_URL);
}

// Check for errors
Expand Down

0 comments on commit 7c6135e

Please sign in to comment.