// Custom exception handler function my_exception_handler($exception) { // put together a detailed exception message $msg = "

Exception Number " . $exception->getCode(); $msg .= $exception->getMessage() . " occurred on line "; $msg .= "" . $exception->getLine() . ""; $msg .= " and in the file: "; $msg .= "" . $exception->getFile() . "

"; // email error message to someone who cares about such things error_log($msg, 1, 'support@domain.com', 'From: reporting@domain.com'); // if exception serious then stop execution and say something if ($exception->getCode() !== E_NOTICE) { die("Sorry the system is down for maintenance. Please try again soon"); } }