Changed error messages to account for NumericalResponse formatting,
which is the only other response type to use StudentInputError.
This commit is contained in:
@@ -834,7 +834,7 @@ class NumericalResponse(LoncapaResponse):
|
||||
import sys
|
||||
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
|
||||
|
||||
if correct:
|
||||
|
||||
@@ -738,7 +738,7 @@ class CapaModule(CapaFields, XModule):
|
||||
# Otherwise, display just an error message,
|
||||
# without a stack trace
|
||||
else:
|
||||
msg = "Error: Problem could not be evaluated with your input"
|
||||
msg = "Error: %s" % str(inst.message)
|
||||
|
||||
return {'success': msg }
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ class CapaModuleTest(unittest.TestCase):
|
||||
result = module.check_problem(get_request_dict)
|
||||
|
||||
# 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'])
|
||||
|
||||
# Expect that the number of attempts is NOT incremented
|
||||
|
||||
Reference in New Issue
Block a user