From 3b375495ffe234b1fbfe7f9fe16880aa0f867f7c Mon Sep 17 00:00:00 2001 From: Mitch Saltykov Date: Fri, 6 Sep 2024 16:32:56 -0400 Subject: [PATCH] remove unnecessary begins --- .../concerns/form_attachment_create.rb | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/app/controllers/concerns/form_attachment_create.rb b/app/controllers/concerns/form_attachment_create.rb index 9f5af8284e4..5cb7da04471 100644 --- a/app/controllers/concerns/form_attachment_create.rb +++ b/app/controllers/concerns/form_attachment_create.rb @@ -19,33 +19,27 @@ def serializer_klass end def validate_file_upload_class! - begin - # is it either ActionDispatch::Http::UploadedFile or Rack::Test::UploadedFile - unless filtered_params[:file_data].class.name.include? 'UploadedFile' - raise Common::Exceptions::InvalidFieldValue.new('file_data', filtered_params[:file_data].class.name) - end - rescue => e - log_exception_to_sentry(e, { context: 'FAC_validate', class: filtered_params[:file_data].class.name }) - raise e + # is it either ActionDispatch::Http::UploadedFile or Rack::Test::UploadedFile + unless filtered_params[:file_data].class.name.include? 'UploadedFile' + raise Common::Exceptions::InvalidFieldValue.new('file_data', filtered_params[:file_data].class.name) end + rescue => e + log_exception_to_sentry(e, { context: 'FAC_validate', class: filtered_params[:file_data].class.name }) + raise e end def save_attachment_to_cloud! - begin - form_attachment.set_file_data!(filtered_params[:file_data], filtered_params[:password]) - rescue => e - log_exception_to_sentry(e, { context: 'FAC_cloud' }) - raise e - end + form_attachment.set_file_data!(filtered_params[:file_data], filtered_params[:password]) + rescue => e + log_exception_to_sentry(e, { context: 'FAC_cloud' }) + raise e end def save_attachment_to_db! - begin - form_attachment.save! - rescue => e - log_exception_to_sentry(e, { context: 'FAC_db', errors: form_attachment.errors }) - raise e - end + form_attachment.save! + rescue => e + log_exception_to_sentry(e, { context: 'FAC_db', errors: form_attachment.errors }) + raise e end def form_attachment