Commit 5bc44e50 by Will Daly

Changed error messages to account for NumericalResponse formatting,

which is the only other response type to use StudentInputError.
parent 8252ba15
...@@ -834,7 +834,7 @@ class NumericalResponse(LoncapaResponse): ...@@ -834,7 +834,7 @@ class NumericalResponse(LoncapaResponse):
import sys import sys
type, value, traceback = sys.exc_info() type, value, traceback = sys.exc_info()
raise StudentInputError, ("Invalid input: could not interpret '%s' as a number" % raise StudentInputError, ("Could not interpret '%s' as a number" %
cgi.escape(student_answer)), traceback cgi.escape(student_answer)), traceback
if correct: if correct:
......
...@@ -738,7 +738,7 @@ class CapaModule(CapaFields, XModule): ...@@ -738,7 +738,7 @@ class CapaModule(CapaFields, XModule):
# Otherwise, display just an error message, # Otherwise, display just an error message,
# without a stack trace # without a stack trace
else: else:
msg = "Error: Problem could not be evaluated with your input" msg = "Error: %s" % str(inst.message)
return {'success': msg } return {'success': msg }
......
...@@ -516,7 +516,7 @@ class CapaModuleTest(unittest.TestCase): ...@@ -516,7 +516,7 @@ class CapaModuleTest(unittest.TestCase):
result = module.check_problem(get_request_dict) result = module.check_problem(get_request_dict)
# Expect an AJAX alert message in 'success' # Expect an AJAX alert message in 'success'
expected_msg = 'Error: Problem could not be evaluated with your input' expected_msg = 'Error: test error'
self.assertEqual(expected_msg, result['success']) self.assertEqual(expected_msg, result['success'])
# Expect that the number of attempts is NOT incremented # Expect that the number of attempts is NOT incremented
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment