Hay I'm creating a code like this :
\Log::info("saving log....");
try{
$data = AstronautCandidateLog::insert($request->logs);
}catch (SQLException $e)
{
\Log::info("SQL Exception happened");
}catch (Exception $e)
{
\Log::info("Exception happened");
}
\Log::info("status save data : ". $data);
But it seems that my Exception never get hit. So how to capture exception in laravel when something wrong in sql query...??
Thanks in advance.
My case: add \ before Exception class otherwise it not handle
try
{
//write your codes here
}
catch(\Exception $e) {
Log::error($e->getMessage());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With