Using exception handling we can make errors catchable by type. If we treat the error as an usual route we can also attach routines to it so it can respect content negotiation (as mentioned on #109).
Original issue content
I have a question about how to implement a error route for a Default 404 Not Found Page, but have not found the solution.
I created a class Error404 controller to display a standard html page, but it did not work:
$router->any('/**', 'Routes\Error404');
I also tried to use the method errorRoute, but without success.
$router->errorRoute($callback);
Is there a solution to this problem?
Thank's all to help me!
Using exception handling we can make errors catchable by type. If we treat the error as an usual route we can also attach routines to it so it can respect content negotiation (as mentioned on #109).
Respect\Rest\Exception\Http\NotFoundexception for404errors instead of just sending a header.Original issue content
I have a question about how to implement a error route for a Default 404 Not Found Page, but have not found the solution.
I created a class Error404 controller to display a standard html page, but it did not work:
$router->any('/**', 'Routes\Error404');I also tried to use the method errorRoute, but without success.
$router->errorRoute($callback);Is there a solution to this problem?
Thank's all to help me!