Commit e8c7e552 by Piotr Mitros

Better error message

parent 837b9c90
......@@ -47,7 +47,10 @@ class numericalresponse(object):
def grade(self, student_answers):
''' Display HTML for a numeric response '''
student_answer = student_answers[self.answer_id]
correct = compare_with_tolerance (evaluator(dict(),dict(),student_answer), self.correct_answer, self.tolerance)
try:
correct = compare_with_tolerance (evaluator(dict(),dict(),student_answer), self.correct_answer, self.tolerance)
except:
raise StudentInputError('Invalid input -- please use a number only')
if correct:
return {self.answer_id:'correct'}
......
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