|
15 | 15 |
|
16 | 16 | namespace Symfony\Component\HttpKernel;
|
17 | 17 |
|
18 |
| -use Exception; |
19 | 18 | use React\Promise\FulfilledPromise;
|
20 | 19 | use React\Promise\PromiseInterface;
|
21 | 20 | use React\Promise\RejectedPromise;
|
|
38 | 37 | use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
39 | 38 | use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
40 | 39 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
| 40 | +use Throwable; |
41 | 41 |
|
42 | 42 | /**
|
43 | 43 | * Class AsyncHttpKernel.
|
@@ -115,18 +115,18 @@ public function handleAsync(
|
115 | 115 | $type
|
116 | 116 | )
|
117 | 117 | ->then(null,
|
118 |
| - function (\Exception $e) use ($request, $type, $catch) { |
119 |
| - if ($e instanceof RequestExceptionInterface) { |
120 |
| - $e = new BadRequestHttpException($e->getMessage(), $e); |
| 118 | + function (Throwable $exception) use ($request, $type, $catch) { |
| 119 | + if ($exception instanceof RequestExceptionInterface) { |
| 120 | + $exception = new BadRequestHttpException($exception->getMessage(), $exception); |
121 | 121 | }
|
122 | 122 |
|
123 | 123 | if (false === $catch) {
|
124 | 124 | $this->finishRequestPromise($request, $type);
|
125 | 125 |
|
126 |
| - throw $e; |
| 126 | + throw $exception; |
127 | 127 | }
|
128 | 128 |
|
129 |
| - return $this->handleExceptionPromise($e, $request, $type); |
| 129 | + return $this->handleExceptionPromise($exception, $request, $type); |
130 | 130 | }
|
131 | 131 | );
|
132 | 132 | }
|
@@ -269,20 +269,20 @@ private function finishRequestPromise(Request $request, int $type)
|
269 | 269 | /**
|
270 | 270 | * Handles an exception by trying to convert it to a Response.
|
271 | 271 | *
|
272 |
| - * @param \Exception $e An \Exception instance |
273 |
| - * @param Request $request A Request instance |
274 |
| - * @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) |
| 272 | + * @param Throwable $exception |
| 273 | + * @param Request $request |
| 274 | + * @param int $type |
275 | 275 | *
|
276 | 276 | * @return PromiseInterface
|
277 | 277 | *
|
278 |
| - * @throws \Exception |
| 278 | + * @throws \Throwable |
279 | 279 | */
|
280 | 280 | private function handleExceptionPromise(
|
281 |
| - Exception $e, |
| 281 | + Throwable $exception, |
282 | 282 | Request $request,
|
283 | 283 | int $type
|
284 | 284 | ): PromiseInterface {
|
285 |
| - $event = new GetResponsePromiseForExceptionEvent($this, $request, $type, $e); |
| 285 | + $event = new GetResponsePromiseForExceptionEvent($this, $request, $type, $exception); |
286 | 286 | $promise = $this
|
287 | 287 | ->dispatcher
|
288 | 288 | ->asyncDispatch(AsyncKernelEvents::ASYNC_EXCEPTION, $event)
|
|
0 commit comments