MDL-57103 lib: Force ajax renderer for all ajax fatal errors

This commit is contained in:
John Okely
2017-06-12 10:36:59 +08:00
parent 760ed1dfde
commit 6ebff58d8c
+8 -1
View File
@@ -384,7 +384,14 @@ function default_exception_handler($ex) {
// If you enable db debugging and exception is thrown, the print footer prints a lot of rubbish
$DB->set_debug(0);
}
echo $OUTPUT->fatal_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo,
if (AJAX_SCRIPT) {
// If we are in an AJAX script we don't want to use PREFERRED_RENDERER_TARGET.
// Because we know we will want to use ajax format.
$renderer = $PAGE->get_renderer('core', null, 'ajax');
} else {
$renderer = $OUTPUT;
}
echo $renderer->fatal_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo,
$info->errorcode);
} catch (Exception $e) {
$out_ex = $e;