I am trying to catch the following error:
(2/2) QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xx.user' doesn't exist (SQL: select count(*) as aggregate from
user
where
With:
use Illuminate\Database\QueryException;
try {
} catch (QueryException $exception) {
// Send email to the administrator
SendEmail::sendError($exception);
return response(['error' => 'Could not create the user'], 500);
} catch (Exception $exception) {
// Send email to the administrator
SendEmail::sendError($exception);
return response(['error' => 'Could not create the user'], 500);
}
But it does not catch. The Exception
should cover the QueryException also but having both or one, in either case, it does not catch the error. I also tried PDOException
but does not help.