I would suggest perhaps structuring your handlers like this. The most general handler comes first, and the later ones "override" it for more specific exceptions. So only errors you don't already handle will be treated as fatal, but the HttpExceptions will be handled.
App::error(function(Exception $e)
{
// Handle fatal errors here, treat as 500 internal server errors.
// Do your fatal error logging and return your 500 view
});
App::error(function(Symfony\Component\HttpKernel\Exception\HttpException $e)
{
// Handle any HTTP exceptions thrown with App::abort() or from Laravel
// for e.g. hitting a missing route
$code = $e->getStatusCode();
switch ($code)
{
// Your existing switch statements
}
});
// Other error handlers, like App::down() for maintenance mode, or a handler for
// model not found exceptions if you use the findOrFail functionality
Thank you very much for your answer. The code that you've posted was worked as expected in another laravel app that i have, but in the one that im working this does not change anything.. im getting again only a 404 text.
Check if App::missing()
is defined in that file (or anywhere else).
It's a 404-specific error handling method in Laravel.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community