Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
gracefully handle case where open().write() fails
Browse files Browse the repository at this point in the history
  • Loading branch information
naknomum committed Feb 16, 2024
1 parent 45797bb commit f2ec034
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/modules/sightings/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,10 @@ def _heatmap_src(cls, extern_ref, q_annot_content_uuid, d_annot_content_uuid):
log.error(
f'non-image on fetching {sage_src} to {filepath}; contents in {filepath}.err'
)
open(filepath + '.err', 'wb').write(resp.content)
try:
open(filepath + '.err', 'wb').write(resp.content)
except Exception as ex:
log.error(f'writing {filepath}.err got error {str(ex)}')
return
try:
resp.raise_for_status()
Expand Down

0 comments on commit f2ec034

Please sign in to comment.