Commit 8252ba15 by Will Daly

Changed error message for StudentInputError for non-staff to

a generic message.  Otherwise, the default exception messages
are cryptic for students (e.g. "cannot convert string to float")
parent 285e3ee1
...@@ -735,10 +735,10 @@ class CapaModule(CapaFields, XModule): ...@@ -735,10 +735,10 @@ class CapaModule(CapaFields, XModule):
if self.system.user_is_staff: if self.system.user_is_staff:
msg = traceback.format_exc() msg = traceback.format_exc()
# Otherwise, display just the error message, # Otherwise, display just an error message,
# without a stack trace # without a stack trace
else: else:
msg = inst.message msg = "Error: Problem could not be evaluated with your input"
return {'success': msg } return {'success': msg }
......
...@@ -516,11 +516,8 @@ class CapaModuleTest(unittest.TestCase): ...@@ -516,11 +516,8 @@ 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'
self.assertTrue('test error' in result['success']) expected_msg = 'Error: Problem could not be evaluated with your input'
self.assertEqual(expected_msg, result['success'])
# We do NOT include traceback information for
# a non-staff user
self.assertFalse('Traceback' in result['success'])
# Expect that the number of attempts is NOT incremented # Expect that the number of attempts is NOT incremented
self.assertEqual(module.attempts, 1) self.assertEqual(module.attempts, 1)
......
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