Commit db885c34 by John Eskew

Fix exception printing and log upon error.

parent 6d4b7cc9
...@@ -89,6 +89,7 @@ class SubmissionRequestError(SubmissionError): ...@@ -89,6 +89,7 @@ class SubmissionRequestError(SubmissionError):
if field_errors is not None if field_errors is not None
else {} else {}
) )
self.args += (self.field_errors,)
def __repr__(self): def __repr__(self):
""" """
...@@ -991,6 +992,11 @@ def _get_or_create_student_item(student_item_dict): ...@@ -991,6 +992,11 @@ def _get_or_create_student_item(student_item_dict):
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(
"Invalid StudentItemSerializer: {}".format(
unicode(student_item_serializer.errors)
)
)
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:
......
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