handle($request); } catch (HttpNotFoundException | EmptyRedis | EmptyResult | Read | Create | Update | Delete $exception) { $serverFilters = [ 'HTTP_', 'QUERY_', 'REDIRECT_', 'REMOTE_', 'REQUEST_', ]; $serverParams = array_filter($request->getServerParams(), fn($key) => count(array_filter($serverFilters, fn($prefix) => str_starts_with($key, $prefix))) > 0, ARRAY_FILTER_USE_KEY); $this->logger->notice($exception, [ 'Server' => $serverParams, 'Headers' => $request->getHeaders(), ]); $response = $this->responseFactory->createResponse(404, 'Not Found'); if (str_contains($request->getUri()->getPath(), '/api')) { return $response; } return $this->view->render($response, 'not_found'); } } }