File tree 4 files changed +31
-0
lines changed 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -74,5 +74,8 @@ executed if the request results in an error::
74
74
}
75
75
);
76
76
77
+ The ``$exception `` of the failure callback SHOULD implement ``Http\Client\Exception ``.
78
+ See :doc: `../httplug/exceptions ` for more information on the exception classes you might encounter.
79
+
77
80
.. _`Promise PSR` : https://groups.google.com/forum/?fromgroups#!topic/php-fig/wzQWpLvNSjs
78
81
.. _Promises/A+ : https://promisesaplus.com
Original file line number Diff line number Diff line change
1
+ Exceptions
2
+ ==========
3
+
4
+ HTTPlug defines a common interface for all exceptions thrown by HTTPlug implementations.
5
+ Every exception thrown by a HTTP client must implement ``Http\Client\Exception ``.
6
+
7
+ ``HttpClient::sendRequest() `` can throw one of the following exceptions.
8
+
9
+ ================================== ============================= ===================
10
+ Exception Thrown when Methods available
11
+ ================================== ============================= ===================
12
+ TransferException something unexpected happened -
13
+ └ RequestException the request is invalid ``getRequest() ``
14
+ |nbsp | |nbsp | └ NetworkException no response received
15
+ due to network issues ``getRequest() ``
16
+ |nbsp | |nbsp | └ HttpException error response ``getRequest() ``
17
+ ``getResponse() ``
18
+ ================================== ============================= ===================
19
+
20
+ .. note ::
21
+
22
+ The ``sendAsyncRequest `` should never throw an exception but always return a
23
+ :doc: `../components/promise `. The exception classes used in ``Promise::wait `` and the ``then ``
24
+ callback are however the same as explained here.
25
+
26
+ .. |nbsp | unicode :: U+00A0 .. non-breaking space
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ HTTPlug defines two HTTP client interfaces that we kept as simple as possible:
18
18
19
19
* ``HttpAsyncClient `` defines a ``sendAsyncRequest `` method that sends a request
20
20
asynchronously and always returns a ``Http\Client\Promise ``.
21
+ See :doc: `../components/promise ` for more information.
21
22
22
23
Implementations
23
24
---------------
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ for discussion around a future HTTP client PSR.
65
65
66
66
Introduction <httplug/introduction >
67
67
Usage <httplug/usage >
68
+ Exceptions <httplug/exceptions >
68
69
Tutorial <httplug/tutorial >
69
70
Migrating <httplug/migrating >
70
71
You can’t perform that action at this time.
0 commit comments