Skip to content

Commit

Permalink
Merge pull request #89 from izrik/get-attachment-diagnostics
Browse files Browse the repository at this point in the history
Log the error.
  • Loading branch information
izrik authored Aug 25, 2022
2 parents 464db86 + 94820f6 commit f1f1a6d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion view/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,18 @@ def attachment_new(self, request, current_user, timestamp=None):
def attachment(self, request, current_user, attachment_id, name):
att = self.ll.pl_get_attachment(attachment_id)
if att is None:
self._logger.error(
f'Error getting attachment "{attachment_id}" from the PL.')
raise NotFound(
"No attachment found for the id '{}'".format(attachment_id))

return self.send_from_directory(self.ll.upload_folder, att.path)
try:
return self.send_from_directory(self.ll.upload_folder, att.path)
except Exception as e:
self._logger.error(
f'Error while sending attachment from directory, '
f'{attachment_id}, {att.path}, {self.ll.upload_folder}: {e}')
raise

def task_up(self, request, current_user, task_id):
show_deleted = request.cookies.get('show_deleted')
Expand Down

0 comments on commit f1f1a6d

Please sign in to comment.