Skip to content

Commit 72fa960

Browse files
committed
fix: php error handling
1 parent 2b58fb7 commit 72fa960

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/app.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ function (Request $request, Response $response) use ($container) {
7979
return is_callable($closure);
8080
};
8181

82-
//var_dump($matcher, $validator);
8382
if (!is_array($matcher) || count(array_filter($matcher, $validator)) !== count($matcher)) {
8483
$response->getBody()->write('POST data key "matcher" must be a serialized list of closures');
8584

@@ -330,7 +329,11 @@ function (Request $request, Response $response) {
330329
?LoggerInterface $logger = null
331330
) use ($app, $notfoundHandler, $phpErrorHandler) {
332331
if ($exception instanceof HttpNotFoundException) {
333-
return $notfoundHandler($request, $app->getResponseFactory()->createResponse());
332+
try {
333+
return $notfoundHandler($request, $app->getResponseFactory()->createResponse());
334+
} catch (Throwable $throwable) {
335+
return $phpErrorHandler($request, $app->getResponseFactory()->createResponse(), $throwable);
336+
}
334337
}
335338

336339
return $phpErrorHandler($request, $app->getResponseFactory()->createResponse(), $exception);

0 commit comments

Comments
 (0)