log errors in exception handler

This commit is contained in:
Max Pozdeev 2019-06-29 18:51:33 +03:00
parent f836683a9c
commit d29e82a543

View file

@ -798,14 +798,20 @@ function myErrorHandler($errno, $errstr, $errfile, $errline)
function myExceptionHandler($e)
{
try { // to avoid Exception thrown without a stack frame
// to avoid Exception thrown without a stack frame
try
{
if(-1 == $e->getCode()) {
//thrown in myErrorHandler
error_log($e->getMessage());
echo $e->getMessage()."\n". $e->getTraceAsString();
exit;
}
error_log('Exception: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine());
echo 'Exception: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine(); //."\n". $e->getTraceAsString();
}
catch(Exception $e) {
error_log('Exception in ExceptionHandler: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine());
echo 'Exception in ExceptionHandler: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine();
}
exit;