Fixed error 500 on HTTP error pages.

This commit is contained in:
flash 2023-12-15 02:40:25 +00:00
parent 0a86525c9d
commit 57c4677d52

View file

@ -22,9 +22,9 @@ class RoutingContext {
}
public function registerDefaultErrorPages(): void {
$this->router->addErrorHandler(401, fn($resp) => $resp->setContent($this->templating->rendering('errors/401')));
$this->router->addErrorHandler(403, fn($resp) => $resp->setContent($this->templating->rendering('errors/403')));
$this->router->addErrorHandler(404, fn($resp) => $resp->setContent($this->templating->rendering('errors/404')));
$this->router->addErrorHandler(401, fn($resp) => $resp->setContent($this->templating->render('errors/401')));
$this->router->addErrorHandler(403, fn($resp) => $resp->setContent($this->templating->render('errors/403')));
$this->router->addErrorHandler(404, fn($resp) => $resp->setContent($this->templating->render('errors/404')));
$this->router->addErrorHandler(500, fn($resp) => $resp->setContent(file_get_contents(HAU_DIR_TEMPLATES . '/errors/500.html')));
$this->router->addErrorHandler(503, fn($resp) => $resp->setContent(file_get_contents(HAU_DIR_TEMPLATES . '/errors/503.html')));
}