Skip to content

Commit 2c6c325

Browse files
committed
---
yaml --- r: 2713 b: refs/heads/update-datastore c: 2e38f02 h: refs/heads/master i: 2711: 88da521
1 parent 4c16482 commit 2c6c325

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: add5924cf0687fd039e2a2ac7e8880699f7bcd65
8+
refs/heads/update-datastore: 2e38f0219904e8d52bbd10de15610d5814f5e30b
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryException.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.google.gcloud.bigquery;
1818

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

5456
public BigQueryException(IOException exception) {
5557
super(exception, true);
56-
this.error = null;
58+
BigQueryError bigqueryError = null;
59+
if (exception instanceof GoogleJsonResponseException) {
60+
GoogleJsonError error = ((GoogleJsonResponseException) exception).getDetails();
61+
if (error != null && error.getErrors() != null && !error.getErrors().isEmpty()) {
62+
GoogleJsonError.ErrorInfo errorInfo = error.getErrors().get(0);
63+
bigqueryError = new BigQueryError(errorInfo.getReason(), errorInfo.getLocation(),
64+
errorInfo.getMessage(), (String) error.get("debugInfo"));
65+
}
66+
}
67+
this.error = bigqueryError;
5768
}
5869

5970
/**

0 commit comments

Comments
 (0)