Error
+ {{$message}}
+diff --git a/app/resources/views/construccion.blade.php b/app/resources/views/construccion.blade.php index 3b1d313..1408838 100644 --- a/app/resources/views/construccion.blade.php +++ b/app/resources/views/construccion.blade.php @@ -10,5 +10,23 @@ Esta parte del sitio está en construcción. + @if (isset($exception)) +
+ @endif + @if (isset($error)) + + @endif @endsection diff --git a/app/src/Middleware/Errors.php b/app/src/Middleware/Errors.php index fae379a..4286df8 100644 --- a/app/src/Middleware/Errors.php +++ b/app/src/Middleware/Errors.php @@ -15,17 +15,22 @@ class Errors public function __construct(protected LoggerInterface $logger, protected ResponseFactoryInterface $responseFactory, protected View $view) {} public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { + $output = []; try { return $handler->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'); + return $this->view->render($response, 'construccion', $output); } }