@@ -924,10 +924,22 @@ In case the response was canceled using ``$response->cancel()``,
924924Handling Exceptions
925925~~~~~~~~~~~~~~~~~~~
926926
927+ There are three types of exceptions, all of which implement the
928+ :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ ExceptionInterface `:
929+
930+ * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ HttpExceptionInterface `
931+ are thrown when your code does not handle the status codes in the 300-599 range.
932+
933+ * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ TransportExceptionInterface `
934+ are thrown when a lower level issue occurs.
935+
936+ * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ DecodingExceptionInterface `
937+ are thrown when a content-type cannot be decoded to the expected representation.
938+
927939When the HTTP status code of the response is in the 300-599 range (i.e. 3xx,
9289404xx or 5xx) your code is expected to handle it. If you don't do that, the
929- ``getHeaders() ``, ``getContent() `` and ``toArray() `` methods throw an appropriate exception, all of
930- which implement the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ HttpExceptionInterface `::
941+ ``getHeaders() ``, ``getContent() `` and ``toArray() `` methods throw an appropriate exception, which will
942+ implement the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ HttpExceptionInterface `::
931943
932944 // the response of this request will be a 403 HTTP error
933945 $response = $client->request('GET', 'https://httpbin.org/status/403');
@@ -968,17 +980,6 @@ errors, exceptions will notify you when needed. On the other hand, if you write
968980the error-handling code, you will opt-out from these fallback mechanisms as the
969981destructor won't have anything remaining to do.
970982
971- There are three types of exceptions:
972-
973- * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ HttpExceptionInterface `
974- are thrown when your code does not handle the status codes in the 300-599 range.
975-
976- * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ TransportExceptionInterface `
977- are thrown when a lower level issue occurs.
978-
979- * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ DecodingExceptionInterface `
980- are thrown when a content-type cannot be decoded to the expected representation.
981-
982983Concurrent Requests
983984-------------------
984985
0 commit comments