Skip to content

Commit

Permalink
Simplify amending message on job result error
Browse files Browse the repository at this point in the history
All GoogleAPICallError (GoogleCloudError) instances have the "message"
attribute, even in Python 3, thus the additional info can be appended
directly to that attribute.
  • Loading branch information
plamut committed Jul 25, 2019
1 parent 92ad0cb commit 13299fe
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bigquery/google/cloud/bigquery/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -2913,9 +2913,8 @@ def result(self, timeout=None, page_size=None, retry=DEFAULT_RETRY):
self.job_id, retry, project=self.project, location=self.location
)
except exceptions.GoogleCloudError as exc:
new_msg = str(exc) + self._format_for_exception(self.query, self.job_id)
new_exc = type(exc)(new_msg)
raise six.raise_from(new_exc, exc)
exc.message += self._format_for_exception(self.query, self.job_id)
raise

# If the query job is complete but there are no query results, this was
# special job, such as a DDL query. Return an empty result set to
Expand Down

0 comments on commit 13299fe

Please sign in to comment.