Commit cb203a6f by Vik Paruchuri

Better error messages

parent 62e93870
......@@ -224,6 +224,7 @@ class CombinedOpenEndedModule(XModule):
current_task_state=self.overwrite_state(current_task_state)
self.current_task=children['modules'][current_task_type](self.system, self.location, self.current_task_parsed_xml, self.current_task_descriptor, self.static_data, instance_state=current_task_state)
log.debug(current_task_state)
return True
def check_allow_reset(self):
......
......@@ -405,23 +405,29 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
correct: Correctness of submission (Boolean)
score: Points to be assigned (numeric, can be float)
"""
fail = {'valid' : False, 'correct' : False, 'points' : 0, 'msg' : ''}
fail = {'valid' : False, 'score' : 0, 'feedback' : ''}
try:
score_result = json.loads(score_msg)
except (TypeError, ValueError):
log.error("External grader message should be a JSON-serialized dict."
" Received score_msg = {0}".format(score_msg))
error_message=("External grader message should be a JSON-serialized dict."
" Received score_msg = {0}".format(score_msg))
log.error(error_message)
fail['feedback']=error_message
return fail
if not isinstance(score_result, dict):
log.error("External grader message should be a JSON-serialized dict."
" Received score_result = {0}".format(score_result))
error_message=("External grader message should be a JSON-serialized dict."
" Received score_result = {0}".format(score_result))
log.error(error_message)
fail['feedback']=error_message
return fail
for tag in ['score', 'feedback', 'grader_type', 'success', 'grader_id', 'submission_id']:
if tag not in score_result:
log.error("External grader message is missing required tag: {0}"
error_message=("External grader message is missing required tag: {0}"
.format(tag))
log.error(error_message)
fail['feedback']=error _message
return fail
#This is to support peer grading
if isinstance(score_result['score'], list):
......
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