Commit ed13f0a0 by Ned Batchelder

Catch up to new exception handling in responses.

parent 5e7d328e
...@@ -1071,10 +1071,7 @@ class CustomResponse(LoncapaResponse): ...@@ -1071,10 +1071,7 @@ class CustomResponse(LoncapaResponse):
try: try:
ret = fn(self.expect, answer_given, **kwargs) ret = fn(self.expect, answer_given, **kwargs)
except Exception as err: except Exception as err:
log.error("oops in customresponse (cfn) error %s" % err) self._handle_exec_exception(err)
# print "context = ",self.context
log.error(traceback.format_exc())
raise Exception("oops in customresponse (cfn) error %s" % err)
log.debug( log.debug(
"[courseware.capa.responsetypes.customresponse.get_score] ret = %s", "[courseware.capa.responsetypes.customresponse.get_score] ret = %s",
ret ret
...@@ -1783,7 +1780,11 @@ class SchematicResponse(LoncapaResponse): ...@@ -1783,7 +1780,11 @@ class SchematicResponse(LoncapaResponse):
json.loads(student_answers[k]) for k in sorted(self.answer_ids) json.loads(student_answers[k]) for k in sorted(self.answer_ids)
] ]
self.context.update({'submission': submission}) self.context.update({'submission': submission})
safe_exec.safe_exec(self.code, self.context, cache=self.system.cache) try:
safe_exec.safe_exec(self.code, self.context, cache=self.system.cache)
except Exception as err:
msg = 'Error %s in evaluating SchematicResponse' % err
raise ResponseError(msg)
cmap = CorrectMap() cmap = CorrectMap()
cmap.set_dict(dict(zip(sorted(self.answer_ids), self.context['correct']))) cmap.set_dict(dict(zip(sorted(self.answer_ids), self.context['correct'])))
return cmap return cmap
......
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