Skip to content

Commit

Permalink
add Sentry logging to narrow down failure mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch-A6 committed Sep 5, 2024
1 parent 4d2ca74 commit 19479d5
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions app/controllers/concerns/form_attachment_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 19479d5

Please sign in to comment.