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")
This commit is contained in:
@@ -735,10 +735,10 @@ class CapaModule(CapaFields, XModule):
|
||||
if self.system.user_is_staff:
|
||||
msg = traceback.format_exc()
|
||||
|
||||
# Otherwise, display just the error message,
|
||||
# Otherwise, display just an error message,
|
||||
# without a stack trace
|
||||
else:
|
||||
msg = inst.message
|
||||
msg = "Error: Problem could not be evaluated with your input"
|
||||
|
||||
return {'success': msg }
|
||||
|
||||
|
||||
@@ -516,11 +516,8 @@ class CapaModuleTest(unittest.TestCase):
|
||||
result = module.check_problem(get_request_dict)
|
||||
|
||||
# Expect an AJAX alert message in 'success'
|
||||
self.assertTrue('test error' in result['success'])
|
||||
|
||||
# We do NOT include traceback information for
|
||||
# a non-staff user
|
||||
self.assertFalse('Traceback' in result['success'])
|
||||
expected_msg = 'Error: Problem could not be evaluated with your input'
|
||||
self.assertEqual(expected_msg, result['success'])
|
||||
|
||||
# Expect that the number of attempts is NOT incremented
|
||||
self.assertEqual(module.attempts, 1)
|
||||
|
||||
Reference in New Issue
Block a user