Laravel carbon not catching exception

716 views Asked by At

i have a simple class:

public function CreateCustomer()
{
 .
 .
 try{
      $birthDate = Carbon::parse($birth)->toIso8601String();
    }catch (\Exception $ex){
      die("error");
    }

And on top of the controller:

use Exception;

I get an error that the exception was Not caught

InvalidArgumentException
Unexpected data found. Trailing data

i've even tried to catch "InvalidArgumentException", but no luck

1

There are 1 answers

0
Ahmed Yusuf On BEST ANSWER

Found the error, it was on

 ->toIso8601String();

As it was generating a double, uncaught exception