Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Show a non-None error for core_exception.Unknown errors. #968

Merged
merged 3 commits into from
Mar 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Next Next commit
fix: Show a non-None error for core_exception.Unknown errors.
  • Loading branch information
sorced-jim committed Mar 8, 2024
commit fcb9431aa6fdd2a3cc7fe1a0cd73d24b1603c759
7 changes: 6 additions & 1 deletion google/cloud/ndb/_retry.py
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