channable / opnieuw

One weird trick to make your code more reliable

Home Page:https://tech.channable.com/posts/2020-02-05-opnieuw.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for raising a different error after certain retries

DanielNoord opened this issue · comments

It comes up quite often that we retry on a certain internal server error of a party we connect with. We would like to do some retries on it, but at some point we need to give up. Very often there is not much we can do and it would be nice to tell this to our users.

By creating something like RetryException(raise_if_exhausted=PlatformInternalError) we can raise an error with a user message after all our retries go through. This would reduce Sentry spam and allow us to give more useful feedback to our customers.

I might not understand the use case. In what way is this different from directly raising and retrying on PlatformInternalError?

That's a good point 😅