Commit 6504532f by John Eskew

Log the submission data when validator says invalid.

parent 4407659e
...@@ -990,18 +990,21 @@ def _get_or_create_student_item(student_item_dict): ...@@ -990,18 +990,21 @@ def _get_or_create_student_item(student_item_dict):
return StudentItem.objects.get(**student_item_dict) return StudentItem.objects.get(**student_item_dict)
except StudentItem.DoesNotExist: except StudentItem.DoesNotExist:
student_item_serializer = StudentItemSerializer( student_item_serializer = StudentItemSerializer(
data=student_item_dict) data=student_item_dict
)
if not student_item_serializer.is_valid(): if not student_item_serializer.is_valid():
logger.error( logger.error(
"Invalid StudentItemSerializer: {}".format( u"Invalid StudentItemSerializer: errors:{} data:{}".format(
unicode(student_item_serializer.errors) student_item_serializer.errors,
student_item_dict
) )
) )
raise SubmissionRequestError(field_errors=student_item_serializer.errors) raise SubmissionRequestError(field_errors=student_item_serializer.errors)
return student_item_serializer.save() return student_item_serializer.save()
except DatabaseError: except DatabaseError:
error_message = u"An error occurred creating student item: {}".format( error_message = u"An error occurred creating student item: {}".format(
student_item_dict) student_item_dict
)
logger.exception(error_message) logger.exception(error_message)
raise SubmissionInternalError(error_message) raise SubmissionInternalError(error_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