From 7b15cd2169c9ecbe1f55199f9684e357a6a38069 Mon Sep 17 00:00:00 2001 From: Mitch Saltykov Date: Thu, 5 Sep 2024 15:55:35 -0400 Subject: [PATCH] add Sentry logging to narrow down failure mode --- .../concerns/form_attachment_create.rb | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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