reqwest-middleware icon indicating copy to clipboard operation
reqwest-middleware copied to clipboard

Add retries to error message

Open konstin opened this issue 8 months ago • 2 comments

As a user or developer, it is hard to tell whether a request failed randomly and was not retried, or whether it failed even with retries (e.g. https://github.com/astral-sh/uv/issues/3514). This PR adds the number of retries to the error chain if there were any retries. Example error chain:

error: Request failed after 3 retries
  Caused by: error sending request for url (https://pypi.org/simple/tqdm/)
  Caused by: client error (Connect)
  Caused by: dns error: failed to lookup address information: Name or service not known
  Caused by: failed to lookup address information: Name or service not known

I've also changed request_middleware::Error transparent to avoid being to verbose.

konstin avatar Jun 11 '24 10:06 konstin