Skip to content

Commit

Permalink
fix: Show a non-None error for core_exception.Unknown errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorced-jim committed Mar 8, 2024
1 parent 70ebac1 commit fcb9431
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion google/cloud/ndb/_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ def retry_wrapper(*args, **kwargs):
result = yield result
except exceptions.NestedRetryException as e:
error = e
except Exception as e:
except BaseException as e:
# `e` is removed from locals at end of block
error = e # See: https://goo.gl/5J8BMK

if not is_transient_error(error):
# If we are in an inner retry block, use special nested
# retry exception to bubble up to outer retry. Else, raise
Expand All @@ -104,6 +105,10 @@ def retry_wrapper(*args, **kwargs):

yield tasklets.sleep(sleep_time)

# Unknown errors really want to show up as None, so manually set the error.
if isinstance(error, core_exceptions.Unknown):
error = "google.api_core.exceptions.Unknown"

raise core_exceptions.RetryError(
"Maximum number of {} retries exceeded while calling {}".format(
retries, callback
Expand Down

0 comments on commit fcb9431

Please sign in to comment.