Can't catch exceptions in laravel

SexyMF picture SexyMF · Apr 20, 2017 · Viewed 11.9k times · Source

I have the following situation:

  try {

        DB::beginTransaction();

        $task = new Task();
        $task->setTracker("");
        //thrown \Symfony\Component\Debug\Exception\FatalThrowableError


            DB::commit();

        }catch (\Exception $e){
            DB::rollBack();
            Log::error($e);
            //throw $e;
        }

I am not entering to the catch area.
Any idea why?

update

This is the error thrown:

[Symfony\Component\Debug\Exception\FatalThrowableError]
Type error: Argument 1 passed to App\Models\Task::setTracker() must be an instance of Carbon\Carbon, integer given, called in /var/www/app/Services/ShareLogic.php on line 60

and will not be catched

Thanks

Answer

SexyMF picture SexyMF · Apr 23, 2017

Catching Throwable did the trick.
Have no idea why? Anyone does?