Hello,
I tried hard to find the answer but nothing so far...
What's the correct way to handle fatal errors in production mode and show 500 page without any error dump on the page. I obviously dont want site users to see the error dump, just nicely formatted Application error page.
When I set ENV to production and try any fatal error I get core/views/errors/production.php page (not core/views/500.php one) with the error dump in the header. All of this is handled in the fuel Error class.
So what's the best practice to override this behavior and show it the correct way on production? Ideally I'd also like to get the error dump by email (why show it on public page?) in addition to recording it in logs. Similar to how Exception Notifier works in Rails.
Thanks for any insights!
Start FuelPHP in the production environment, and all will be taken care of.
The core/views/errors/production.php view doesn't give you any details, it only says "An unexpected error has occurred.". If you see a dump, you're not in a production environment.
To modify the view, copy it to app/views/errors/production.php and change it to your liking. The Error class will use the app version if one exists.
In addition, the 500 view is shown when you throw HttpServerErrorException, so a code generated server error.
A fatal error in your code is not considered a 500, it's considered code that should not be in production.