Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 7cf7f15

Browse files
committed
Merge pull request #295 from penegiryk/hotfix/php7-exceptions-support
Add support for PHP 7 exceptions
2 parents 737ddc1 + 90f8de0 commit 7cf7f15

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/TemplatedErrorHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ protected function handleError($error, Request $request, Response $response)
160160
* Proxies to `handleError()`; exists primarily to as an extension point
161161
* for other handlers.
162162
*
163-
* @param \Exception $exception
163+
* @param \Throwable $exception
164164
* @param Request $request
165165
* @param Response $response
166166
* @return Response
167167
*/
168-
protected function handleException(\Exception $exception, Request $request, Response $response)
168+
protected function handleException($exception, Request $request, Response $response)
169169
{
170170
return $this->handleError($exception, $request, $response);
171171
}
@@ -277,7 +277,7 @@ private function handleErrorResponse($error, Request $request, Response $respons
277277
{
278278
$response = $response->withStatus(Utils::getStatusCode($error, $response));
279279

280-
if (! $error instanceof \Exception) {
280+
if (! $error instanceof \Exception && ! $error instanceof \Throwable) {
281281
return $this->handleError($error, $request, $response);
282282
}
283283

src/WhoopsErrorHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ public function __construct(
6969
* the generated payload, and then injects the response with the result
7070
* of whoops handling the exception.
7171
*
72-
* @param \Exception $exception
72+
* @param \Throwable $exception
7373
* @param Request $request
7474
* @param Response $response
7575
* @return Response
7676
*/
77-
protected function handleException(\Exception $exception, Request $request, Response $response)
77+
protected function handleException($exception, Request $request, Response $response)
7878
{
7979
$this->prepareWhoopsHandler($request);
8080

0 commit comments

Comments
 (0)