backoff icon indicating copy to clipboard operation
backoff copied to clipboard

Specify exceptions with specific details

Open deeplook opened this issue 5 years ago • 2 comments

First: very cool/useful package! Thanks!!

I would like to backoff/retry certain HTTP exceptions like 429, too many requests, but at the moment this isn't possible because there is only a generic requests.exceptions.HTTPError. I've looked into backoff.on_exception() and it looks like it could be extended to have something like a details parameter, maybe a dict with some keys and expected values. Does that sound doable? If so I could give it a try...

deeplook avatar Oct 15 '20 11:10 deeplook

Meanwhile I've found an easier workaround by throwing my own custom exception and handling that with backoff.

deeplook avatar Oct 16 '20 08:10 deeplook

You can also use the giveup keyword which allows you to inspect the exception.

bgreen-litl avatar Oct 16 '20 12:10 bgreen-litl