-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle DataError during XForms submission. #1537
Conversation
onadata/libs/utils/logger_tools.py
Outdated
@@ -403,14 +404,16 @@ def safe_create_instance(username, xml_file, media_files, uuid, request): | |||
error = OpenRosaResponseBadRequest( | |||
_(u"Unable to submit because there are multiple forms with" | |||
u" this formID.")) | |||
except DataError as e: | |||
error = OpenRosaResponseBadRequest( | |||
'Data Incompatible with the database provided') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the exceptions, it seems we had a calculate field that returned an Infinity result. I am wondering whether rejecting such submissions is the right way to go about it. Can we be clear in our message of the issue so that an enumerator can know what to check and change on their end? Or should we accept the result as is and replace the Infinity with something that can be stored in a JSON field?
It would be ideal to see if we can actually replicate the issue to determine if the issue is in the data collection tools Enketo or ODK Collect and what could be potentially be solved on that end.
71081d0
to
8fa4643
Compare
onadata/libs/utils/logger_tools.py
Outdated
@@ -353,7 +353,8 @@ def create_instance(username, | |||
instance.save() | |||
|
|||
instance = DuplicateInstance() | |||
|
|||
except DataError as error: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This except
block here is irrelevant, we are not raising a specific exception. I will recommend removing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
onadata/libs/utils/logger_tools.py
Outdated
@@ -403,14 +404,17 @@ def safe_create_instance(username, xml_file, media_files, uuid, request): | |||
error = OpenRosaResponseBadRequest( | |||
_(u"Unable to submit because there are multiple forms with" | |||
u" this formID.")) | |||
except DataError as e: | |||
error = OpenRosaResponseBadRequest( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this have to be 3 lines could, OpenRosaResponseBadRequest(str(e))
not fit within the 79/80 line limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
8fa4643
to
38594ec
Compare
Fixes #1535 and #949