Commit 4407659e by Alex Dusenbery Committed by GitHub

Merge pull request #63 from edx/jeskew/further_logging_field_errors

Fix exception printing and log upon error.
parents 6d4b7cc9 839d93e3
......@@ -33,7 +33,7 @@ def load_requirements(*requirements_paths):
setup(
name='edx-submissions',
version='2.0.4',
version='2.0.5',
author='edX',
description='An API for creating submissions and scores.',
url='http://github.com/edx/edx-submissions.git',
......
......@@ -89,6 +89,7 @@ class SubmissionRequestError(SubmissionError):
if field_errors is not None
else {}
)
self.args += (self.field_errors,)
def __repr__(self):
"""
......@@ -991,6 +992,11 @@ def _get_or_create_student_item(student_item_dict):
student_item_serializer = StudentItemSerializer(
data=student_item_dict)
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)
return student_item_serializer.save()
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