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

Catch IOError when saving osm data #1382

Merged
merged 3 commits into from
Apr 26, 2018
Merged

Catch IOError when saving osm data #1382

merged 3 commits into from
Apr 26, 2018

Conversation

Wambere
Copy link
Contributor

@Wambere Wambere commented Apr 25, 2018

  • Catch exception and raise Http404
  • Add test
  • Sort imports

Fix #839

@Wambere Wambere requested a review from ukanga April 25, 2018 14:15
try:
osm_xml = osm.media_file.read()
except IOError as e:
raise Http404(str(e))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Http404?

Copy link
Member

@ukanga ukanga Apr 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Http404 will not make sense when this is run by celery as an async task. I will recommend failing silently and simply skip to the next attachment on the list.

- Catch exception and raise Http404
- Add test
- Sort imports
- Change test to check that IOError is not raised and not that 404 is raised
- Change att to attachment in test for clarity
- Change name and docstring of test to be clearer
@ukanga ukanga merged commit ab1042d into master Apr 26, 2018
@ukanga ukanga deleted the issue-839 branch April 26, 2018 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants