Http client getting status() in retries is broken

Laravel Version

10.35.0

PHP Version

8.1.26

Database Driver & Version

Mysql 5.7

Description

When using the retries feature of the Http client, attempting to get the status from the response as per the docs throws an error and I’m unable to get the response status code.

Steps To Reproduce

  1. Make a get request anywhere to a domain that doesn’t exist via the Http client
  2. Implement the retries function like this:
$client = $client->retry(3, 100, function (Exception $exception, PendingRequest $request) {
    Log::debug('foo');
    Log::debug($exception->response->status()); // <-- this line is erroring
    Log::debug('bar'); // <-- I never make it here

    return true;
});

Observe the error:

Undefined property: IlluminateHttpClientConnectionException::$response

Also, I see my foo log but never the bar log.

Either the docs is wrong, or getting the response is broken. The domain I used deliberately is one that hangs, which is intentional: sdfsd.com