is_retryable_error

Function is_retryable_error 

Source
pub fn is_retryable_error(error: &Error) -> (bool, Option<u64>)
Expand description

What: Determine if an error is retryable and extract retry-after information.

Inputs:

  • error: The reqwest::Error to classify

Output:

  • (bool, Option<u64>) where the bool indicates if the error is retryable, and the Option contains retry-after seconds if available from headers

Details:

  • Timeout errors are retryable
  • Connection errors are retryable
  • HTTP 5xx status codes are retryable
  • HTTP 429 (rate limit) is retryable and may include Retry-After header
  • HTTP 4xx (except 429) are not retryable (client errors)
  • HTTP 3xx are not retryable (redirects handled by reqwest)