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

Commit f5e24a6

Browse files
committed
Merge branch 'hotfix/295'
Close #295
2 parents 737ddc1 + f174e4a commit f5e24a6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Initial stable release.
1414
Documentation can now be found at: https://zendframework.github.io/zend-expressive/
1515
- [#299](https://github.com/zendframework/zend-expressive/pull/299) adds
1616
component-specific CSS to the documentation.
17+
- [#295](https://github.com/zendframework/zend-expressive/pull/295) adds
18+
support for handling PHP 7 engine exceptions in the templated and whoops final
19+
handlers.
1720

1821
### Deprecated
1922

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)