@@ -1020,10 +1020,22 @@ In case the response was canceled using ``$response->cancel()``,
10201020Handling Exceptions
10211021~~~~~~~~~~~~~~~~~~~
10221022
1023+ There are three types of exceptions, all of which implement the
1024+ :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ ExceptionInterface `:
1025+
1026+ * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ HttpExceptionInterface `
1027+ are thrown when your code does not handle the status codes in the 300-599 range.
1028+
1029+ * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ TransportExceptionInterface `
1030+ are thrown when a lower level issue occurs.
1031+
1032+ * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ DecodingExceptionInterface `
1033+ are thrown when a content-type cannot be decoded to the expected representation.
1034+
10231035When the HTTP status code of the response is in the 300-599 range (i.e. 3xx,
102410364xx or 5xx) your code is expected to handle it. If you don't do that, the
1025- ``getHeaders() ``, ``getContent() `` and ``toArray() `` methods throw an appropriate exception, all of
1026- which implement the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ HttpExceptionInterface `::
1037+ ``getHeaders() ``, ``getContent() `` and ``toArray() `` methods throw an appropriate exception, which will
1038+ implement the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ HttpExceptionInterface `::
10271039
10281040 // the response of this request will be a 403 HTTP error
10291041 $response = $client->request('GET', 'https://httpbin.org/status/403');
@@ -1061,19 +1073,9 @@ responses in an array::
10611073This behavior provided at destruction-time is part of the fail-safe design of the
10621074component. No errors will be unnoticed: if you don't write the code to handle
10631075errors, exceptions will notify you when needed. On the other hand, if you write
1064- the error-handling code, you will opt-out from these fallback mechanisms as the
1065- destructor won't have anything remaining to do.
1066-
1067- There are three types of exceptions:
1068-
1069- * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ HttpExceptionInterface `
1070- are thrown when your code does not handle the status codes in the 300-599 range.
1071-
1072- * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ TransportExceptionInterface `
1073- are thrown when a lower level issue occurs.
1074-
1075- * Exceptions implementing the :class: `Symfony\\ Contracts\\ HttpClient\\ Exception\\ DecodingExceptionInterface `
1076- are thrown when a content-type cannot be decoded to the expected representation.
1076+ the error-handling code (by calling ``$response->getStatusCode() ``), you will
1077+ opt-out from these fallback mechanisms as the destructor won't have anything
1078+ remaining to do.
10771079
10781080Concurrent Requests
10791081-------------------
0 commit comments