Php exception capture

in tp5, you want to execute logic 1 first, execute logic 2 when logic 1 fails, and return an error

if logic 2 also fails.

when I execute the following code, the system executes the error class defined by tp5 instead of the error format defined by myself

related codes

<?php 

try {
    //1
} catch (\Exception $e) {
    // 2
} catch(\Exception $e){
    //
    return $e->getMessage();
}

return "success";
?>

I want to execute my own defined error to return

Php
Jul.14,2021

//
return $e->getMessage();

you all know that this is the error return, so just put the error here in the format you want

.

Exception is the exception base class. All exceptions will achieve this. Sense exception catch priority strategy, you have caught all runtime exceptions in the first catch, so a little catch will not be executed. Continue try in the second code block if necessary. Or custom exceptions.

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-1b35f3e-2bfcb.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-1b35f3e-2bfcb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?