handle($request); } catch (Exception $exception) { $output['message'] = $exception->getMessage(); $output['exception'] = $exception; $this->logger->warning($exception); } catch (Error $error) { $output['message'] = $error->getMessage(); $output['error'] = $error; $this->logger->error($error); } $response = $this->responseFactory->createResponse(500, 'Internal Server Error'); if (str_contains($request->getUri()->getPath(), '/api')) { return $response; } return $this->view->render($response, 'construccion', $output); } }