What if: We remove 404 error handling? |
In fact, I would like to consider a different approach to handling 404 error.
By default, a 404 error caused by an exception uses the error_404 file to generate the error, and this file is in the application's views. Currently, a developer can define a custom handler for 404 errors in routes. A handler can be a controller or a closure. Why don't I like this. 1. The fact that the 404 handler is defined in the routes collection, although only indirectly related to routes. 2. The fact that the controller call is used, which obliges the handler to be inherited from the Controller class. My suggestion. Since @kenjis added in 4.4 the ability to define global custom exception handlers, I'd like to hear your feedback on the 404 error handling I'm proposing. 1. Make the error_404 view a system file, i.e. the developer will no longer be able to change it, but the framework will use this file by default. 2. Remove the ability to set a 404 error handler from the route. Instead, it will be possible to handle the exception through the new custom exceptions feature. |
Messages In This Thread |
What if: We remove 404 error handling? - by iRedds - 04-29-2023, 07:45 AM
RE: What if: We remove 404 error handling? - by kenjis - 04-29-2023, 03:32 PM
RE: What if: We remove 404 error handling? - by iRedds - 04-29-2023, 08:45 PM
|