handle($request); } catch (HttpNotFoundException | EmptyRedis | EmptyResult | Read | Create | Update | Delete $exception) { $this->logger->notice($exception, [ 'Server' => $request->getServerParams(), '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'); } } }