Commit 79568dfd by kimth

Add error logging for external grader messages

parent c406be8c
...@@ -1210,11 +1210,14 @@ class CodeResponse(LoncapaResponse): ...@@ -1210,11 +1210,14 @@ class CodeResponse(LoncapaResponse):
try: try:
score_result = json.loads(score_msg) score_result = json.loads(score_msg)
except (TypeError, ValueError): except (TypeError, ValueError):
log.error("External grader message should be a JSON-serialized dict")
return fail return fail
if not isinstance(score_result, dict): if not isinstance(score_result, dict):
log.error("External grader message should be a JSON-serialized dict")
return fail return fail
for tag in ['correct', 'score', 'msg']: for tag in ['correct', 'score', 'msg']:
if not score_result.has_key(tag): if not score_result.has_key(tag):
log.error("External grader message is missing one or more required tags: 'correct', 'score', 'msg'")
return fail return fail
# Next, we need to check that the contents of the external grader message # Next, we need to check that the contents of the external grader message
......
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