Skip to content
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

API is returning enketo url with the value 'false' on some edits #1072

Closed
KipSigei opened this issue Jul 25, 2017 · 1 comment · Fixed by #1080
Closed

API is returning enketo url with the value 'false' on some edits #1072

KipSigei opened this issue Jul 25, 2017 · 1 comment · Fixed by #1080

Comments

@KipSigei
Copy link
Contributor

KipSigei commented Jul 25, 2017

API Endpoint: /data/[pk]/[dataid]/enketo

Expected:
Return status 400 with an appropriate failure message if a submission edit URL is not present.

Aha! Link: https://ona.aha.io/features/PROD-542

@KipSigei KipSigei added this to the Week 30 - 31 milestone Jul 25, 2017
@ukanga ukanga changed the title Prevent API from returning url : false if submission edit enketo url is not provided API is returning enketo url with the value 'false' on some edits Aug 3, 2017
@ukanga ukanga added the Error label Aug 3, 2017
@ukanga
Copy link
Member

ukanga commented Aug 3, 2017

This happened because we were posting a too large body to Enketo than what it was configured to receive. In this case, we need to handle HTTP status codes >= 400 and return an appropriate error message to the user.

moshthepitt added a commit that referenced this issue Aug 3, 2017
Fixes: #1072

We discovored that the API endpoint to get an enketo edit url
encountered >400 level errors it did not properly set the HTTP
status code and instead returned the edit url as false.

This set of commits fixes that by raising an EnketoError exception
which has a friendly default error message that can be overriden.
ukanga pushed a commit that referenced this issue Aug 4, 2017
* Ensure that >400 level HTTP errors are properly handled

Fixes: #1072

We discovored that the API endpoint to get an enketo edit url
encountered >400 level errors it did not properly set the HTTP
status code and instead returned the edit url as false.

This set of commits fixes that by raising an EnketoError exception
which has a friendly default error message that can be overriden.

* Move EnketoError exception to onadata.libs.exceptions.py

Moved this exception here for consistency..

* Report errors caught while trying to get enketo edit url

These are mostly 400 level errors.  We ask the user to contact support
and so keeping a record of the errors encountered is a good idea, for
referencing.

In the spirit of DRY, we merged the duplicated report_exception functions
in logger_tools and viewer_tools and moved it to common_tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants