class Aws::Plugins::RetryErrors::LegacyHandler

def call(context)

def call(context)
  response = @handler.call(context)
  if response.error
    error_inspector = Retries::ErrorInspector.new(
      response.error, response.context.http_response.status_code
    )
    if error_inspector.endpoint_discovery?(context)
      key = context.config.endpoint_cache.extract_key(context)
      context.config.endpoint_cache.delete(key)
    end
    retry_if_possible(response, error_inspector)
  else
    response
  end
end

def delay_retry(context)

def delay_retry(context)
  context.config.retry_backoff.call(context)
end

def refresh_credentials?(context, error)

def refresh_credentials?(context, error)
  error.expired_credentials? &&
    context.config.credentials.respond_to?(:refresh!)
end

def response_truncatable?(context)

def response_truncatable?(context)
  context.http_response.body.respond_to?(:truncate)
end

def retry_if_possible(response, error_inspector)

def retry_if_possible(response, error_inspector)
  context = response.context
  if should_retry?(context, error_inspector)
    retry_request(context, error_inspector)
  else
    response
  end
end

def retry_limit(context)

def retry_limit(context)
  context.config.retry_limit
end

def retry_request(context, error)

def retry_request(context, error)
  delay_retry(context)
  context.retries += 1
  context.config.credentials.refresh! if refresh_credentials?(context, error)
  context.http_request.body.rewind
  context.http_response.reset
  call(context)
end

def should_retry?(context, error)

def should_retry?(context, error)
  error.retryable?(context) &&
    context.retries < retry_limit(context) &&
    response_truncatable?(context)
end