fix: TNL-8233: Change exception raised at problem creation failure from generic exception to LoncapaProblemError. (#27361)

Raising this specific exception will cause the failure to be handled more gracefully by problem rescoring code.
This commit is contained in:
Julia Eskew
2021-04-21 16:13:23 -04:00
committed by GitHub
parent a1fe3d58dc
commit efa13ff1d2
4 changed files with 40 additions and 3 deletions

View File

@@ -170,7 +170,18 @@ def rescore_problem_module_state(xmodule_instance_args, module_descriptor, stude
# specific events from CAPA are not propagated up the stack. Do we want this?
try:
instance.rescore(only_if_higher=task_input['only_if_higher'])
except (LoncapaProblemError, StudentInputError, ResponseError):
except (LoncapaProblemError, ResponseError):
# Capture a backtrace for these errors, but only a warning below for student input errors.
TASK_LOG.exception(
"error processing rescore call for course %(course)s, problem %(loc)s "
"and student %(student)s",
dict(
course=course_id,
loc=usage_key,
student=student
)
)
except StudentInputError:
TASK_LOG.warning(
"error processing rescore call for course %(course)s, problem %(loc)s "
"and student %(student)s",