Please tell me whether it is correct to use try in php in this way.

when writing a lottery, when opening a lottery, the winning information is stored in redis, and then the following code is written to call it. Please check whether it is used correctly

.
    public function giveOutGoldFoins()
    {
        $object = new cache();
        $userObj = new user();
        $UserFundsLog = new UserFundsLog();
        $cathectic = new cathectic();
        while (true) {
            try{
                $data = $object->lpop("win_the_lottery");
                if(false == $data){
                    break;
                }
                $logData = json_decode($data,true);
                //
                $sql = "UPDATE `ct_user` SET `gold` = gold+".$logData["money"]."  WHERE `id` = ".$logData["user_id"];
                $result = $userObj->updateData($sql,[]);
                //
                $sql = "UPDATE `ct_cathectic` SET `state`=1 WHERE id=".$logData["id"];
                $res = $cathectic->updateData($sql,[]);
                //
                $log = [
                    ":user_id" => $logData["user_id"],
                    ":classify"=> MONEY_FLOW_LOTTERY,
                    ":number"  => $logData["money"],
                    ":before_num" => $logData["gold"],
                    ":after_num"  => $logData["gold"]+$logData["money"],
                    ":explain"    => ":".$logData["issue"].",".$logData["money"]."",
                    ":data"          => $logData["data"],
                    ":create_time"=> time(),
                ];
                $sql = "INSERT INTO `lottery`.`ct_user_funds_log` (`user_id`, `classify`, `number`, `before_num`, `after_num`, `explain`, `data`, `create_time`) VALUES (:user_id, :classify, :number, :before_num, :after_num, :explain, :data, :create_time)";
                $UserFundsLog->addData($sql,$log);
            }catch(Exception $e){
                file_put_contents(".log",$e->getMessage().PHP_EOL, FILE_APPEND);
            }
        }
    }
Mar.10,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9aea1-475ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9aea1-475ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?