I would like to set up Redis to handle sessions, however, I found an issue. When I stop the Redis service I get a Predis \ Connection \ ConnectionException which makes sense, however, on a production server I want to handle this type of error better for users. For example, display my custom error page instead of the default error page that comes with Laravel for production errors and log the error.
I thought about adding a try catch to the index.php file, however, that is adding error logic in two places (global.php and index.php). I'm not sure what is the best way to go here.
Is there a way to make sure all system/php/laravel errors go through the global.php exception handling logic?
Would like to hear any thoughts on how to resolve this issue. Thanks.
In case there is an issue replicating this issue here is some meta information.
Code snippets
// index.php
// Current fix
try {
$app->run();
}
catch (Exception $e)
{
// handle exception
}
// global.php
// Would rather handle all errors here
App::error(function(Exception $exception, $code)
{
// some logic...
return Response::view('custom-error-page', $data, $code);
});