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

In on_exception pass current exception's instance to on_giveup #72

Closed
michaeltcoelho opened this issue Apr 22, 2019 · 0 comments · Fixed by #172
Closed

In on_exception pass current exception's instance to on_giveup #72

michaeltcoelho opened this issue Apr 22, 2019 · 0 comments · Fixed by #172

Comments

@michaeltcoelho
Copy link

michaeltcoelho commented Apr 22, 2019

It would be nice if the current exception being handled in on_exception function could pass the exception's instance to the on_giveup handler.

Also i've noticed that there's only an "empty" raise statement after giving up on retrying. Wouldn't it be correct to reraise the current exception's instance itself?

**When StopIteration is raised the exception being handled when calling the decorated function is reraised.

Snippet with the code i'm talking about:

backoff/backoff/_sync.py

Lines 100 to 108 in 229d30a

if giveup(e) or max_tries_exceeded or max_time_exceeded:
_call_handlers(on_giveup, *details)
raise
try:
seconds = _next_wait(wait, jitter, elapsed, max_time_)
except StopIteration:
_call_handlers(on_giveup, *details)
raise e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant