/** * Catches all otherwise uncaught exceptions. Will be deliberately used in some * situations. After this is called the script will end, so make sure to catch * any exceptions that you can deal with. * * @param Exception $e The exception that was thrown. * @access private */ function exception(Exception $e) { global $USER; if ($USER) { if (!$e instanceof MaharaException || get_class($e) == 'MaharaException') { log_warn("An exception was thrown of class " . get_class($e) . ". \nTHIS IS BAD " . "and should be changed to something extending MaharaException,\n" . "unless the exception is from a third party library.\n" . "Original trace follows", true, false); log_message($e->getMessage(), LOG_LEVEL_WARN, true, true, $e->getFile(), $e->getLine(), $e->getTrace()); $e = new SystemException($e->getMessage()); $e->set_log_off(); } } // Display the message and die $e->handle_exception(); }