From ea8c3a88137cf46be61c3db368e5a29e6b860928 Mon Sep 17 00:00:00 2001 From: Clement Herreman Date: Fri, 14 Feb 2020 14:42:35 +0100 Subject: [PATCH] Try to make the exception handling more clear --- components/http_client.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/http_client.rst b/components/http_client.rst index e0bf92b934c..cb1626af7e7 100644 --- a/components/http_client.rst +++ b/components/http_client.rst @@ -561,6 +561,13 @@ that network errors can happen when calling e.g. ``getStatusCode()`` too:: .. note:: Because ``$response->getInfo()`` is non-blocking, it shouldn't throw by design. + +.. note:: + + The exceptions are thrown during the response `__destruct()` method. This + means that if you do not store `$client->request(...)` in a variable + (like in the example above), you do not need to call any methods of the + returned responses. When multiplexing responses, you can deal with errors for individual streams by catching ``TransportExceptionInterface`` in the foreach loop::