Skip to content

Commit

Permalink
Show the proper error message if a GCS exception is thrown without a …
Browse files Browse the repository at this point in the history
….message. (#27538)

* Show the proper error message if an exception is thrown without a .message.

* Use "raise from" instead of message introspection.

* Linting
  • Loading branch information
psobot authored Jul 18, 2023
1 parent dff2844 commit 62a8087
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sdks/python/apache_beam/io/gcp/gcsio.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,6 @@ def finish(self):
self._upload_thread.join()
# Check for exception since the last put() call.
if self._upload_thread.last_error is not None:
e = self._upload_thread.last_error
raise type(self._upload_thread.last_error)(
"Error while uploading file %s: %s",
self._path,
self._upload_thread.last_error.message) # pylint: disable=raising-bad-type
"Error while uploading file %s" % self._path) from e # pylint: disable=raising-bad-type

0 comments on commit 62a8087

Please sign in to comment.