Support the ongoing development of Laravel.io →
Requests
Last updated 2 years ago.
0

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
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Check if App::missing() is defined in that file (or anywhere else).

It's a 404-specific error handling method in Laravel.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.