I am using Laravel 4.2.
I would like to ignore non-fatal errors. So far the only via method is described at Disable laravel error handler but this has a couple of drawbacks:
- Ignores all errors - not a good idea
- By-passes Laravel error handling altogether - this can cause problem with future versions of Lavarel
The recommended way of handling errors is described at https://laravel.com/docs/4.2/errors (or https://laravel.com/docs/5.1/errors for those using Laravel 5). So, I can capture fatal errors using:
App::fatal(function($exception)
{
return defaultError(500);
});
And this captures non-fatal:
App::error(function(ErrorException $exception) {
Log::error($exception);
return 'Oops! Looks like something went wrong';
});
The 2 gives me a demarcation between fatal and non-fatal. But for non-fatal I would like to display the actual page (which I am able to using Disable laravel error handler) instead of 'Oops! Looks like something went wrong'.
In plain PHP this can be achieved using error_reporting(0)
as described at http://php.net/manual/en/function.error-reporting.php.
Is this feasible in Laravel?
Thanks.