diff --git a/app/controllers/concerns/form_attachment_create.rb b/app/controllers/concerns/form_attachment_create.rb index fa9b1430ad3..885858f3e47 100644 --- a/app/controllers/concerns/form_attachment_create.rb +++ b/app/controllers/concerns/form_attachment_create.rb @@ -2,11 +2,29 @@ module FormAttachmentCreate extend ActiveSupport::Concern + include SentryLogging def create - validate_file_upload_class! - save_attachment_to_cloud! - save_attachment_to_db! + begin + validate_file_upload_class! + rescue => e + log_exception_to_sentry(e, { context: 'FAC_validate', class: filtered_params[:file_data].class.name }) + raise e + end + + begin + save_attachment_to_cloud! + rescue => e + log_exception_to_sentry(e, { context: 'FAC_cloud'}) + raise e + end + + begin + save_attachment_to_db! + rescue => e + log_exception_to_sentry(e, { context: 'FAC_db', errors: form_attachment.errors}) + raise e + end render json: serializer_klass.new(form_attachment) end