Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions google/api_core/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
if deadline_datetime is not None:
if deadline_datetime <= now:
raise exceptions.RetryError(
"Deadline of {:.1f}s exceeded while calling {}".format(
deadline, target
"Deadline of {:.1f}s exceeded while calling target function".format(
deadline
),
last_exc,
) from last_exc
Expand Down
4 changes: 2 additions & 2 deletions google/api_core/retry_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ async def retry_target(target, predicate, sleep_generator, deadline, on_error=No
# Chains the raising RetryError with the root cause error,
# which helps observability and debugability.
raise exceptions.RetryError(
"Deadline of {:.1f}s exceeded while calling {}".format(
deadline, target
"Deadline of {:.1f}s exceeded while calling target function".format(
deadline
),
last_exc,
) from last_exc
Expand Down
4 changes: 4 additions & 0 deletions tests/asyncio/test_retry_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ async def test_retry_target_deadline_exceeded(utcnow, sleep):
assert exc_info.match("last exception: meep")
assert target.call_count == 2

# Ensure the exception message does not include the target fn:
# it may be a partial with user data embedded
assert str(target) not in exc_info.exconly()


@pytest.mark.asyncio
async def test_retry_target_bad_sleep_generator():
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ def test_retry_target_deadline_exceeded(utcnow, sleep):
assert exc_info.match("last exception: meep")
assert target.call_count == 2

# Ensure the exception message does not include the target fn:
# it may be a partial with user data embedded
assert str(target) not in exc_info.exconly()


def test_retry_target_bad_sleep_generator():
with pytest.raises(ValueError, match="Sleep generator"):
Expand Down