php - How can I handle exeption in lumen?

one text

I want to log an error when it occurs.

my cotroller is like this :

  try {
    Wallet::create([
     'name' => 'TET',
   ]);
   } catch (QueryException $e) {
        $message = Str::contains($e->getMessage(), 'Deadlock') ? 'Server is busy' : $e->getMessage();
        throw new HttpException(400, $message);

    } catch (\Exception $e) {
        throw new HttpException(400, $e->getMessage());
    }
  

my App\Exceptions\Handler.php is like this:

public function report(Throwable $exception)
{
    if ($exception instanceof QueryException) {
        Log::error($exception->getMessage());
    }

    parent::report($exception);
}

but exception is not as instanceof QueryException.

Source