aboutsummaryrefslogtreecommitdiff
path: root/displayformula.php
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2021-11-10 15:05:27 -0700
committerJohn Denker <jsd@av8n.com>2021-11-10 15:05:27 -0700
commit00f7ed380b90cc003c3f99a6ce116b885a7469ec (patch)
treea5c5803fa5ec643bac9559e5e48da36d91fa5d00 /displayformula.php
parentd8e30f21278e2326b09097f99a8e5423112a8e8e (diff)
display more-informative error message;
required stripping off two layers of concealment
Diffstat (limited to 'displayformula.php')
-rw-r--r--displayformula.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/displayformula.php b/displayformula.php
index 6ba12fb..9890ea5 100644
--- a/displayformula.php
+++ b/displayformula.php
@@ -34,7 +34,7 @@ global $PAGE, $CFG;
require_login();
$p = new qtype_algebra_parser;
-$validanswer = true;
+$errmsg = '';
try {
$query = urldecode($_SERVER['QUERY_STRING']);
@@ -66,16 +66,15 @@ try {
}
} catch (Exception $e) {
- $validanswer = false;
- $texexp = get_string('parseerror', 'qtype_algebra', $e->getMessage());
+ $errmsg = $e->getMessage();
}
$formatoptions = new stdClass;
$formatoptions->para = false;
$PAGE->set_context(context_system::instance());
-if ($validanswer) {
+if ($errmsg == '') {
$text = format_text($texexp, FORMAT_MOODLE, $formatoptions);
} else {
- $text = get_string('invalidanswer', 'qtype_algebra');
+ $text = get_string('trivial_1', 'qtype_algebra', $errmsg);
}
?>
<html>