diff --git a/app/src/app/Core/Router.php b/app/src/app/Core/Router.php index b1f5c413..ca353370 100644 --- a/app/src/app/Core/Router.php +++ b/app/src/app/Core/Router.php @@ -141,19 +141,21 @@ protected function handleMiddlewares(array $middlewares): void throw new Exception("Middleware {$middlewareClass} must implement MiddlewareInterface"); } - $middleware->handle($_REQUEST, fn () => null); + $middleware->handle($_REQUEST, fn() => null); } } protected function abort(int $statusCode, string $message): void { - if ($statusCode === 404) { - View::render([ - 'view' => 'Error/404', - 'title' => 'Error 404', - 'layout' => 'BlankLayout' - ]); - } + View::render([ + 'view' => "Error", + 'title' => "Error $statusCode", + 'layout' => 'PublicLayout', + 'data' => [ + 'code' => $statusCode, + 'message' => $message, + ], + ]); http_response_code($statusCode); exit; } diff --git a/app/src/app/Layouts/BlankLayout.php b/app/src/app/Layouts/BlankLayout.php index 3feb91b6..45b15835 100644 --- a/app/src/app/Layouts/BlankLayout.php +++ b/app/src/app/Layouts/BlankLayout.php @@ -1,19 +1 @@ - - - -
- - -Acceso Denegado
-Lo sentimos, la página a la que intentas acceder no está disponible para ti.
-= $message; ?>
+ +Página no encontrada
-Lo sentimos, la página que buscas no existe o fue movida.
- -