Skip to content
Snippets Groups Projects
Commit ad64c3a4 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Fix error reporting in chat script.

parent 350d8a1f
No related branches found
No related tags found
No related merge requests found
...@@ -96,9 +96,11 @@ if ($string) { ...@@ -96,9 +96,11 @@ if ($string) {
$keyvals = new stack_cas_keyval($vars, $options, 0); $keyvals = new stack_cas_keyval($vars, $options, 0);
$keyvals->get_valid(); $keyvals->get_valid();
$varerrs = $keyvals->get_errors(); $varerrs = $keyvals->get_errors();
if ($keyvals->get_valid()) {
$kvcode = $keyvals->compile('test')['statement']; $kvcode = $keyvals->compile('test')['statement'];
$statements = [new stack_secure_loader($kvcode, 'caschat')]; $statements = [new stack_secure_loader($kvcode, 'caschat')];
} }
}
$ct = null; $ct = null;
if (!$varerrs) { if (!$varerrs) {
...@@ -114,8 +116,12 @@ if ($string) { ...@@ -114,8 +116,12 @@ if ($string) {
foreach ($session->get_errors(false) as $err) { foreach ($session->get_errors(false) as $err) {
$errs = array_merge($errs, $err); $errs = array_merge($errs, $err);
} }
if ($errs) {
$errs = stack_string_error('errors') . ': ' . implode(' ', array_unique($errs)); $errs = stack_string_error('errors') . ': ' . implode(' ', array_unique($errs));
$errs = html_writer::tag('div', $errs, array('class' => 'error')); $errs = html_writer::tag('div', $errs, array('class' => 'error'));
} else {
$errs = '';
}
$debuginfo = $session->get_debuginfo(); $debuginfo = $session->get_debuginfo();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment