vendredi 17 janvier 2020

Laravel won't catch \Exception, \Throwable, nor nothing at all

Using Laravel 5.7 on PHP 7.3. I've spent hours on this and read every single answer on Stack Overflow, but nothing wants to work. I'm forcing an exception to happen in my code:

public function my_function(Request $request) {
    try {
        require_once(app_path() . '/Libs/my-custom-inexisting-php-file.php');
    } catch (\Exception $e) {
        // Do something
    }
}

I'm still getting the Laravel exception, it's not getting within the catch statement.

Symfony\Component\Debug\Exception\FatalErrorException: 
App\Http\Controllers\MyController::my_function(): Failed opening required 
'/home/vagrant/code/my-project/app/Libs/my-custom-inexisting-php-file.php'

I tried with Exception, \Exception, Throwable, \Throwable, ErrorException, \ErrorException, Symfony\Component\Debug\Exception\FatalErrorException, \Error, Error.

And I'm still not catching it. Any help would be very much appreciated.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2R52oYh
via IFTTT

Aucun commentaire:

Enregistrer un commentaire