MDL-54879 mod_lti: Add fallback options for error message upon failure

This commit is contained in:
Jun Pataleta
2016-07-28 14:38:29 +08:00
parent d1a3ea62ef
commit 653b8ef24b
+11
View File
@@ -45,6 +45,17 @@ $PAGE->set_pagelayout('maintenance');
$output = $PAGE->get_renderer('mod_lti');
echo $output->header();
// Check status and lti_errormsg.
if ($status !== 'success' && empty($err)) {
// We have a failed status and an empty lti_errormsg. Check if we can use lti_msg.
if (!empty($msg)) {
// The lti_msg attribute is set, use this as the error message.
$err = $msg;
} else {
// Otherwise, use our generic error message.
$err = get_string('failedtocreatetooltype', 'mod_lti');
}
}
$params = array('message' => s($msg), 'error' => s($err), 'id' => $id, 'status' => s($status));
$page = new \mod_lti\output\external_registration_return_page();