I need to implement a atexitPython function that will receive the last error object and check its type. If the python error type matches PHP E_ERROR, I have to save the error output to a file.
The PHP code I'm porting looks like this:
register_shutdown_function( "fatal_handler" );
function fatal_handler() {
$error = error_get_last();
if ($error != null && $error['type'] === E_ERROR)
echo "recordFatalError: {$error['message']}\n";
}
My code binding is as follows:
def fatal_handler():
atexit.register(fatal_handler)
I would be glad if someone explained to me how I can get the necessary functionality using python.
source
share