Skip to content

Commit

Permalink
Merge pull request #5656 from rubyforgood/fix-prod-more-2
Browse files Browse the repository at this point in the history
add error catching for whatever untested terrible thing may be happen…
  • Loading branch information
compwron authored May 5, 2024
2 parents 74a165c + 14c0148 commit ec92bdf
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/controllers/case_contacts/form_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,22 @@ def case_contact_params
# Deletes the current associations (from the join table) only if the submitted form body has the parameters for
# the contact_type ids.
def remove_unwanted_contact_types
if params.dig(:case_contact, :case_contact_contact_type_attributes)
@case_contact.case_contact_contact_type.destroy_all
begin
if params.dig(:case_contact, :case_contact_contact_type_attributes) # TODO this sometimes raises errors in prod.
@case_contact.case_contact_contact_type.destroy_all
end
rescue => e
Bugsnag.notify(e)
end
end

def remove_nil_draft_ids
if params.dig(:case_contact, :draft_case_ids)
params[:case_contact][:draft_case_ids] -= [""]
begin
if params.dig(:case_contact, :draft_case_ids)
params[:case_contact][:draft_case_ids] -= [""]
end
rescue => e
Bugsnag.notify(e)
end
end

Expand Down

0 comments on commit ec92bdf

Please sign in to comment.