Custom 404 and 405 error pages

This commit is contained in:
Pierre Rudloff 2020-07-15 23:17:23 +02:00
parent 280618bb6b
commit b6b4dad2ec
3 changed files with 24 additions and 1 deletions

View file

@ -260,6 +260,28 @@ class FrontController extends BaseController
return $response->withStatus(StatusCode::HTTP_INTERNAL_SERVER_ERROR);
}
/**
* @param Request $request
* @param Response $response
* @return Response
*/
public function notFound(Request $request, Response $response)
{
return $this->displayError($request, $response, $this->localeManager->t('Page not found'))
->withStatus(StatusCode::HTTP_NOT_FOUND);
}
/**
* @param Request $request
* @param Response $response
* @return Response
*/
public function notAllowed(Request $request, Response $response)
{
return $this->displayError($request, $response, $this->localeManager->t('Method not allowed'))
->withStatus(StatusCode::HTTP_METHOD_NOT_ALLOWED);
}
/**
* Display an error page.
*