diff --git a/sdks/python/apache_beam/io/gcp/gcsio.py b/sdks/python/apache_beam/io/gcp/gcsio.py index 5aee4f5aaf38..2010d2292593 100644 --- a/sdks/python/apache_beam/io/gcp/gcsio.py +++ b/sdks/python/apache_beam/io/gcp/gcsio.py @@ -823,4 +823,7 @@ def finish(self): self._upload_thread.join() # Check for exception since the last put() call. if self._upload_thread.last_error is not None: - raise self._upload_thread.last_error # pylint: disable=raising-bad-type + 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