immobiliare/RealHTTP

[Feature]: include underlying error for HTTP errors with retryAttemptsReached

Opened this issue · 0 comments

What problem are you facing?

Hi,
I am trying to use the retry mechanism and I am wondering if it was possible to include the returned error for the last retry.

For example, I have an endpoint that I want to query until it returns a valid response. Otherwise, if it returns an error response with a specific type in it, I want to do retry. When it reaches the max retries count, I get a HTTPError with the category retryAttemptsReached, but I'd like to know if it could be possible to get the last error response that triggered the retry.

From what I see in the code, the logic is a bit weird: you send that error only at the next retry. Shouldn't it be check after the last response instead?

Other Information

No response