getkirby / ideas

This is the backlog of ideas and feature requests from the last two years. Use our new feedback platform to post your new ideas or vote on existing ideas.
https://feedback.getkirby.com
20 stars 0 forks source link

Allow custom error handlers via hooks #478

Open florianmrz opened 4 years ago

florianmrz commented 4 years ago

I recently wanted to add a custom error handler to our Kirby, but there's no easy way to do so. In theory it is very simple, because Kirby uses Whoops which allows you to register multiple handlers for different errors. To add my custom logging logic to the existing ones from Kirby, I had to overwrite the logic for all three error handlers in \Kirby\Cms\AppErrors.

It would be a lot easier if Kirby allowed you to register custom error handlers for all three error types (CLI, HTML and JSON), possibly via the already existing hooks.

bastianallgeier commented 4 years ago

Ohhhh, that's a lovely idea and indeed not very difficult! This would also solve the wish of many to customize the fatal error screen.