Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 0741d0b

Browse files
committed
None case in _get_status
1 parent 9069d34 commit 0741d0b

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

google/cloud/bigtable/data/_async/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,6 @@ def mutations_batcher(
14741474
batch_operation_timeout=batch_operation_timeout,
14751475
batch_attempt_timeout=batch_attempt_timeout,
14761476
batch_retryable_errors=batch_retryable_errors,
1477-
_batch_completed_callback=_batch_completed_callback,
14781477
)
14791478

14801479
@CrossSync.convert

google/cloud/bigtable/data/_helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"""
1717
from __future__ import annotations
1818

19-
from typing import Callable, Sequence, List, Tuple, TYPE_CHECKING, Union
19+
from typing import Callable, Sequence, List, Optional, Tuple, TYPE_CHECKING, Union
2020
import time
2121
import enum
2222
from collections import namedtuple
@@ -263,7 +263,7 @@ def _get_statuses_from_mutations_exception_group(
263263
return statuses
264264

265265

266-
def _get_status(exc: Exception) -> status_pb2.Status:
266+
def _get_status(exc: Optional[Exception]) -> status_pb2.Status:
267267
"""
268268
Helper function that returns a Status object corresponding to the given exception.
269269
@@ -284,7 +284,7 @@ def _get_status(exc: Exception) -> status_pb2.Status:
284284

285285
return status_pb2.Status(
286286
code=code_pb2.Code.UNKNOWN,
287-
message=str(exc),
287+
message=str(exc) if exc else "An unknown error has occurred",
288288
)
289289

290290

google/cloud/bigtable/data/_sync_autogen/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,6 @@ def mutations_batcher(
12241224
batch_operation_timeout=batch_operation_timeout,
12251225
batch_attempt_timeout=batch_attempt_timeout,
12261226
batch_retryable_errors=batch_retryable_errors,
1227-
_batch_completed_callback=_batch_completed_callback,
12281227
)
12291228

12301229
def mutate_row(

tests/unit/data/test__helpers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,22 @@ class TestGetStatusesFromMutationsExceptionGroup:
313313
),
314314
status_pb2.Status(code=code_pb2.UNKNOWN, message="Something happened"),
315315
),
316+
(
317+
0,
318+
bt_exceptions.RetryExceptionGroup(
319+
excs=[
320+
core_exceptions.ServiceUnavailable("Service Unavailable"),
321+
core_exceptions.ServiceUnavailable("Service Unavailable"),
322+
None,
323+
]
324+
),
325+
status_pb2.Status(code=code_pb2.UNKNOWN, message="An unknown error has occurred"),
326+
),
327+
(
328+
0,
329+
None,
330+
status_pb2.Status(code=code_pb2.UNKNOWN, message="An unknown error has occurred"),
331+
),
316332
(
317333
100,
318334
RuntimeError("Something happened"),

0 commit comments

Comments
 (0)