Skip to content

Commit b99ce32

Browse files
committed
cleanup exception doc
1 parent 328676e commit b99ce32

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

components/promise.rst

+3
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,8 @@ executed if the request results in an error::
7474
}
7575
);
7676

77+
The ``$exception`` of the failure callback SHOULD implement ``Http\Client\Exception``.
78+
See :doc:`exceptions` for more information on the exception classes you might encounter.
79+
7780
.. _`Promise PSR`: https://groups.google.com/forum/?fromgroups#!topic/php-fig/wzQWpLvNSjs
7881
.. _Promises/A+: https://promisesaplus.com

httplug/exceptions.rst

+17-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
Exceptions
22
==========
33

4-
HTTPlug defines one Exception interface: ``Http\Client\Exception``. All HTTP
5-
client exceptions must implement this interface.
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``.
66

77
``HttpClient::sendRequest()`` can throw one of the following exceptions.
88

9-
================================== ====================== ===================
10-
Exception Thrown when Methods available
11-
================================== ====================== ===================
12-
TransferException ???
13-
└ RequestException the request is invalid ``getRequest()``
9+
================================== ============================= ===================
10+
Exception Thrown when Methods available
11+
================================== ============================= ===================
12+
TransferException something unexpected happened -
13+
└ RequestException the request is invalid ``getRequest()``
1414
|nbsp| |nbsp| └ NetworkException no response received
15-
due to network issues ``getRequest()``
16-
|nbsp| |nbsp| └ HttpException error response ``getRequest()``
17-
``getResponse()``
18-
================================== ====================== ===================
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:`promise`. The exception classes used in ``Promise::wait`` and the ``then``
24+
callback are however the same as explained here.
1925

2026
.. |nbsp| unicode:: U+00A0 .. non-breaking space

httplug/introduction.rst

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ HTTPlug defines two HTTP client interfaces that we kept as simple as possible:
1818

1919
* ``HttpAsyncClient`` defines a ``sendAsyncRequest`` method that sends a request
2020
asynchronously and always returns a ``Http\Client\Promise``.
21+
See :doc:`../components/promise` for more information.
2122

2223
Implementations
2324
---------------

0 commit comments

Comments
 (0)