You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
Throw Respect\Rest\Exception\Http\NotFound exception for 404 errors instead of just sending a header.
Create a default route to catch this exception, ensuring current behaviour is not affected.
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!
The text was updated successfully, but these errors were encountered:
I've updated the issue description (keeping the original post under it) with a proposal which I think can handle this and #109 well. This solution is specially motivated by #109.
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\NotFound
exception for404
errors 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!
The text was updated successfully, but these errors were encountered: