aboutsummaryrefslogtreecommitdiff
path: root/displayformula.php
diff options
context:
space:
mode:
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>