@@ -249,12 +249,27 @@ Synchronous Requests
249249####################
250250
251251A request can be made by passing a Request instance in the ``run `` method, which
252- will return a `Response `_ or throw an exception if it fails:
252+ will return a `Response `_ or throw an ``Framework\HTTP\Client\RequestException ``
253+ if it fails:
253254
254255.. code-block :: php
255256
256257 $response = $client->run($request); // Framework\HTTP\Client\Response
257258
259+ If you call the Request's ``setGetInfo `` method, it will be possible to obtain
260+ information from curl through the exception's ``getInfo `` method:
261+
262+ .. code-block :: php
263+
264+ $request->setGetInfo();
265+
266+ try {
267+ $response = $client->run($request); // Framework\HTTP\Client\Response
268+ } catch (Framework\HTTP\Client\RequestException $exception) {
269+ echo $exception->getMessage(); // string
270+ var_dump($exception->getInfo(); // array
271+ }
272+
258273 Asynchronous Requests
259274#####################
260275
@@ -287,9 +302,9 @@ Responses will be delivered as requests are finalized:
287302 echo '<pre >' . htmlentities((string) $response) . '</pre >';
288303 }
289304
290- In the ``run `` method, an exception is thrown if the connection fails. On the
291- other hand, the ``runMulti `` method does not throw exceptions so that requests
292- are not interrupted.
305+ In the ``run `` method, the `` Framework\HTTP\Client\RequestException `` exception
306+ is thrown if the connection fails. On the other hand, the ``runMulti `` method
307+ does not throw exceptions so that requests are not interrupted.
293308
294309To find out if a request failed, perform a check similar to the code example
295310above.
@@ -382,8 +397,8 @@ error on the connection.
382397With it is possible to obtain the instance of the Request that ran it with the
383398``getRequest `` method and the error with the ``getError `` method.
384399
385- If the Request is getting info from the response , it is possible to obtain more
386- information with the ``getInfo `` method.
400+ If the Request is getting info, it is possible to obtain more information with
401+ the ``getInfo `` method.
387402
388403
389404Conclusion
0 commit comments