Skip to content

Commit acad464

Browse files
committed
---
yaml --- r: 1583 b: refs/heads/master c: 2e38f02 h: refs/heads/master i: 1581: 77e2f9d 1579: 9e28763 1575: 75af56e 1567: 7295b88
1 parent d55eb2c commit acad464

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: add5924cf0687fd039e2a2ac7e8880699f7bcd65
2+
refs/heads/master: 2e38f0219904e8d52bbd10de15610d5814f5e30b
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: d1b373c30c176edc08692348167bec3a244bb823
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3

trunk/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)