Closed
Description
Symfony version(s) affected
6.3.8
Description
Looks like Symfony's RetryableHttpClient messes up exceptions in case of a timeout.
As showed at the reproducer if request is sent using "GET" method, client throws TimeoutException - which is correct.
But as soon as you change "GET" with "POST", exception class changes to TransportException, even though both exceptions messages are same.
If such behaviour is expected - then how to correctly identify a timeout without weirdly parsing and matching exception message?
Reproduced with php 8.2 and symfony 6.3.8
cc @jderusse maybe you will have some insights, since retryable client is written by you
How to reproduce
$client = new RetryableHttpClient(HttpClient::create());
try {
dump('GET');
$client->request('GET', 'https://httpbin.org/delay/5', ['timeout' => 1.0]);
} catch (\Symfony\Contracts\HttpClient\Exception\ExceptionInterface $e) {
dump($e::class . '::' . $e->getMessage());
}
// GET
// Symfony\Component\HttpClient\Exception\TimeoutException::Idle timeout reached for "https://httpbin.org/delay/5".
try {
dump('POST');
$client->request('POST', 'https://httpbin.org/delay/5', ['timeout' => 1.0]);
} catch (\Symfony\Contracts\HttpClient\Exception\ExceptionInterface $e) {
dump($e::class . '::' . $e->getMessage());
}
// POST
// Symfony\Component\HttpClient\Exception\TransportException::Idle timeout reached for "https://httpbin.org/delay/5".
Possible Solution
No response
Additional Context
No response