Skip to content

Commit 9eb555f

Browse files
authored
docs: update error handling comment to be more precise in samples (#3712)
* docs: update error handling comment to be more precise in samples * style * style * update comment * ignoredUnusedDeclaredDependencies * revert wrong commit/PR push ignoredUnusedDeclaredDependencies
1 parent 251def5 commit 9eb555f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

samples/snippets/src/main/java/com/example/bigquery/SimpleApp.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ public static void simpleApp(String projectId) {
6767
// Check for errors
6868
if (queryJob == null) {
6969
throw new RuntimeException("Job no longer exists");
70-
} else if (queryJob.getStatus().getError() != null) {
71-
// You can also look at queryJob.getStatus().getExecutionErrors() for all
72-
// errors, not just the latest one.
73-
throw new RuntimeException(queryJob.getStatus().getError().toString());
70+
} else if (queryJob.getStatus().getExecutionErrors() != null
71+
&& queryJob.getStatus().getExecutionErrors().size() > 0) {
72+
// TODO(developer): Handle errors here. An error here do not necessarily mean that the job
73+
// has completed or was unsuccessful.
74+
// For more details: https://cloud.google.com/bigquery/troubleshooting-errors
75+
throw new RuntimeException("An unhandled error has occurred");
7476
}
7577
// [END bigquery_simple_app_query]
7678

0 commit comments

Comments
 (0)