Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.google.gcloud.bigquery;

import com.google.api.client.googleapis.json.GoogleJsonError;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.common.collect.ImmutableSet;
import com.google.gcloud.BaseServiceException;
import com.google.gcloud.RetryHelper.RetryHelperException;
Expand Down Expand Up @@ -53,7 +55,16 @@ public BigQueryException(int code, String message, BigQueryError error) {

public BigQueryException(IOException exception) {
super(exception, true);
this.error = null;
BigQueryError bigqueryError = null;

This comment was marked as spam.

if (exception instanceof GoogleJsonResponseException) {
GoogleJsonError error = ((GoogleJsonResponseException) exception).getDetails();
if (error != null && error.getErrors() != null && !error.getErrors().isEmpty()) {
GoogleJsonError.ErrorInfo errorInfo = error.getErrors().get(0);
bigqueryError = new BigQueryError(errorInfo.getReason(), errorInfo.getLocation(),
errorInfo.getMessage(), (String) error.get("debugInfo"));
}
}
this.error = bigqueryError;
}

/**
Expand Down