Fix when missing logo on remote storage crash email sending

This commit is contained in:
Mathieu Magnin 2019-04-11 15:08:10 +02:00
parent b7b2029490
commit 0770362fb4

View file

@ -39,9 +39,14 @@ class NotificationMailer < ApplicationMailer
create_commentaire_for_notification(dossier, subject, body)
if dossier.procedure.logo?
logo_filename = dossier.procedure.logo.filename
attachments.inline[logo_filename] = dossier.procedure.logo.read
@logo_url = attachments[logo_filename].url
begin
logo_filename = dossier.procedure.logo.filename
attachments.inline[logo_filename] = dossier.procedure.logo.read
@logo_url = attachments[logo_filename].url
rescue StandardError => e
# A problem occured when reading logo, maybe the logo is missing and we should clean the procedure to remove logo reference ?
Raven.capture_exception(e)
end
end
@dossier = dossier