themes: MDL-19640 / MDL-19077 remove other references to _print_normal_error

This commit is contained in:
tjhunt 2009-06-29 00:34:49 +00:00
parent 86ffb13965
commit fd1a792e13
3 changed files with 20 additions and 30 deletions

View File

@ -581,7 +581,7 @@ function get_current_group($courseid, $full = false) {
* @return void Terminates script, does not return!
*/
function error($message, $link='') {
global $UNITTEST;
global $UNITTEST, $OUTPUT;
// If unittest running, throw exception instead
if (!empty($UNITTEST->running)) {
@ -590,7 +590,9 @@ function error($message, $link='') {
throw new moodle_exception('notlocalisederrormessage', 'error', $link, $message);
}
_print_normal_error('notlocalisederrormessage', 'error', $message, $link, debug_backtrace(), null, true); // show debug warning
list($message, $moreinfourl, $link) = prepare_error_message('notlocalisederrormessage', 'error', $link, $message);
$OUTPUT->fatal_error($message, $moreinfourl, $link, debug_backtrace(), null, true); // show debug warning
die;
}

View File

@ -117,8 +117,13 @@ class invalid_state_exception extends moodle_exception {
/**
* Default exception handler, uncought exceptions are equivalent to using print_error()
*
* @param Exception $ex
* @param boolean $isupgrade
* @param string $plugin
* Does not return. Terminates execution.
*/
function default_exception_handler($ex) {
function default_exception_handler($ex, $isupgrade = false, $plugin = null) {
global $CFG, $DB, $SCRIPT;
// detect active db transactions, rollback and log as error
@ -159,6 +164,14 @@ function default_exception_handler($ex) {
list($message, $moreinfourl, $link) = prepare_error_message($errorcode, $module, $link, $a);
if ($isupgrade) {
// First log upgrade error
upgrade_log(UPGRADE_LOG_ERROR, $plugin, 'Exception: ' . get_class($ex), $message, $backtrace);
// Always turn on debugging - admins need to know what is going on
$CFG->debug = DEBUG_DEVELOPER;
}
if ($earlyerror) {
// Error found before setup.php finished
_print_early_error($message, $backtrace, $debuginfo);

View File

@ -627,33 +627,8 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
/**
* upgrade logging functions
*/
function upgrade_handle_exception($ex, $plugin=null) {
global $CFG;
if ($ex instanceof moodle_exception) {
$details = get_string($ex->errorcode, $ex->module, $ex->a)."<br />debugging:".$ex->debuginfo;
} else {
$details = get_string('generalexceptionmessage', 'error', $ex->getMessage());
}
$info = "Exception: ".get_class($ex);
$backtrace = $ex->getTrace();
$place = array('file'=>$ex->getFile(), 'line'=>$ex->getLine(), 'exception'=>get_class($ex));
array_unshift($backtrace, $place);
/// first log upgrade error
upgrade_log(UPGRADE_LOG_ERROR, $plugin, $info, $details, $backtrace);
// always turn on debugging - admins need to know what is going on
$CFG->debug = DEBUG_DEVELOPER;
// now print the exception info as usually
if ($ex instanceof moodle_exception) {
_print_normal_error($ex->errorcode, $ex->module, $ex->a, $ex->link, $backtrace, $ex->debuginfo);
} else {
_print_normal_error('generalexceptionmessage', 'error', $ex->getMessage(), '', $backtrace);
}
die; // not reached
function upgrade_handle_exception($ex, $plugin = null) {
default_exception_handler($ex, true, $plugin);
}
/**