immobiliare / immobiliare/RealHTTP

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

Open
#78 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
292
Forks
29
PR merge metrics
No merged PRs in 30d

Description

### 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_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the retry mechanism and the HTTPError handling for the retryAttemptsReached category. Determine how the final retry response is propagated, then make the last error response available when retries are exhausted and verify the behavior with the project's existing retry or HTTP error tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.