handle($request); } catch (HttpNotFoundException $exception) { $this->logger->warning($exception); $response = $this->responseFactory->createResponse(404); if (str_contains($request->getUri()->getPath(), '/api')) { return $response; } return $this->view->render($response, 'not_found'); } } }