Skip to content

Commit 57774e9

Browse files
added guard against None causes
1 parent c169575 commit 57774e9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • packages/google-cloud-bigtable/google/cloud/bigtable

packages/google-cloud-bigtable/google/cloud/bigtable/batcher.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,12 @@ def _close_batcher(self):
131131
self._batcher.close()
132132
except MutationsExceptionGroup as exc_group:
133133
for error in exc_group.exceptions:
134-
# Unpack the root cause of the FailedMutationEntryError
135-
# and return that error to the user.
136-
self._exceptions.put(error.__cause__)
134+
# Unpack the root cause of the FailedMutationEntryError and
135+
# return that error to the user. In standard execution paths,
136+
# FailedMutationEntryError always has an Exception cause;
137+
# defensively fall back to error itself if __cause__ is None.
138+
cause = error.__cause__ if error.__cause__ is not None else error
139+
self._exceptions.put(cause)
137140

138141
def __enter__(self):
139142
"""Starting the MutationsBatcher as a context manager"""

0 commit comments

Comments
 (0)