Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add error catching for whatever untested terrible thing may be happen… #5656

Merged
merged 1 commit into from
May 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Loading