Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpClient] RetryableHttpClient messes timeout exception #52587

Copy link
Copy link
Closed
@rmikalkenas

Description

@rmikalkenas
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.