first commit

This commit is contained in:
Pavel Shevaev 2022-05-16 14:22:21 +03:00
commit 4d0eed50f0
2 changed files with 27 additions and 0 deletions

0
README.md Normal file
View File

27
error.inc.php Normal file
View File

@ -0,0 +1,27 @@
<?php
function _gamectl_error_handler($errno, $errstr, $errfile, $errline)
{
if($errno == E_STRICT)
return;
// @ sign temporary disabled error reporting
if(error_reporting() == 0)
return;
$err = "Error happened: $errno, $errstr, $errfile, $errline\n";
throw new Exception($err);
}
function _gamectl_exception_handler($e)
{
$msg = $e . "\n=== ERROR DIGEST ===\n" . $e->getMessage() . "\n";
$stderr = fopen('php://stderr', 'a');
fwrite($stderr, $msg);
fclose($stderr);
exit(1);
}
set_error_handler("_gamectl_error_handler");
set_exception_handler("_gamectl_exception_handler");