Skip to content

Commit 606d5cd

Browse files
authored
Merge pull request #151 from Nyholm/plugin-exception
Be more specific about plugin exceptions
2 parents e81c202 + 31812d9 commit 606d5cd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

plugins/build-your-own.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Like in case of the ``$next`` callable, you must pass the ``$request`` as the fi
6767
or you will end up in an infinite execution loop.
6868

6969
The ``$next`` and ``$first`` callables will return a :doc:`/components/promise`.
70-
You can manipulate the ``ResponseInterface`` or the ``Exception`` by using the
70+
You can manipulate the ``Psr\Http\Message\ResponseInterface`` or the ``Http\Client\Exception`` by using the
7171
``then`` method of the promise::
7272

7373
public function handleRequest(RequestInterface $request, callable $next, callable $first)
@@ -76,7 +76,7 @@ You can manipulate the ``ResponseInterface`` or the ``Exception`` by using the
7676

7777
return $next($request)->then(function (ResponseInterface $response) {
7878
return $response->withHeader('MyResponseHeader', 'value');
79-
}, function (Exception $exception) {
79+
}, function (\Http\Client\Exception $exception) {
8080
echo $exception->getMessage();
8181

8282
throw $exception;
@@ -89,6 +89,11 @@ You can manipulate the ``ResponseInterface`` or the ``Exception`` by using the
8989
PSR_ is released. Once it is out, we will use this PSR in HTTPlug and
9090
deprecate the old contract.
9191

92+
.. warning::
93+
94+
If a plugin throws an exception that does not implement ``Http\Client\Exception``
95+
it will break the plugin chain.
96+
9297
To better understand the whole process check existing implementations in the
9398
`client-common package`_.
9499

0 commit comments

Comments
 (0)