Skip to content

Instantly share code, notes, and snippets.

@weatheredwatcher
Created February 16, 2010 02:05
Show Gist options
  • Save weatheredwatcher/305213 to your computer and use it in GitHub Desktop.
Save weatheredwatcher/305213 to your computer and use it in GitHub Desktop.
function myErrorHandler($errno, $errstr, $errfile, $errline)
/**
*
* This is a collection of custom error handling procedures for the Leveraged Media System
* It is loaded in the main index file and overrides all error handling with the exception of fatal memory errors
*/
{
$myLog = new Log;
$myLog->set_page($_SERVER['PHP_SELF']);
switch ($errno) {
case E_USER_ERROR:
$myLog->set_log("ERROR:[$errno] Fatal error on line $errline ");
$myLog->write_log();
exit(1);
break;
case E_USER_WARNING:
$myLog->set_log("WARNING:[$errno] $errstr ");
$myLog->write_log();
break;
case E_USER_NOTICE:
$myLog->set_log("NOTICE:[$errno] $errstr ");
$myLog->write_log();
break;
default:
$myLog->set_log("Unknown Error Type:[$errno] $errstr ");
$myLog->write_log();
break;
}
/* Don't execute PHP internal error handler */
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment