How to know whether the imported file is completed and how to catch the error

function description: the project needs some scheduled tasks to be executed regularly, write a file, create an A file, configure the execution time of each PHP task file, etc., and then the server adds a scheduled task to call A file,

question: if one of the files has a fatal error and stops execution, it will cause subsequent files to stop running. Is there a way to judge whether the task file introduced is successful, for example, file 500 error, etc. When there is an error, I write it into the error log and try the try method, which has no effect. What ideas do the gods have?

/ execute the file

if($is_load && is_file($value["url"])){
    echo ":" . $value["url"];
    $time_arr[$value["k"]] = 0;
    try {
        include_once "./".$value["url"];
    } catch (Exception $exc) {
        echo $exc->getTraceAsString();
    }
    
    log_tao(":". $value["url"], 0);
}
Php
Mar.05,2021

include there is a return value. Check the return value to see if it was introduced successfully.

but. Why is it possible that the introduced file has a 500code error ? Isn't code error the ultimate bug?


add a judgment to the possible place in the imported file, throw an exception if the execution fails, and then capture the log

throw new \Exception("Not Found!",404);

PHP
https://blog.csdn.net/hjtl1992/article/details/72328480

fatal error is impossible to try, you try to use the register_shutdown_function function to register the function at the end of the script. Or use the set_error_handler function to catch errors.

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