Skip to content

Commit

Permalink
Omit errors from analytics when error_details available
Browse files Browse the repository at this point in the history
changelog: Internal, Analytics, Omit errors from analytics when error_details available
  • Loading branch information
aduth committed Jan 28, 2025
1 parent 4eddf18 commit 37c882f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/services/form_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def success?

def to_h
hash = { success: success }
hash[:errors] = errors.presence if !serialize_error_details_only?
hash[:errors] = (!defined?(@error_details) && errors).presence if !serialize_error_details_only?
hash[:error_details] = flatten_details(error_details) if error_details.present?
hash.merge!(extra)
hash
Expand Down
12 changes: 3 additions & 9 deletions spec/services/form_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@
response = FormResponse.new(success: false, errors: errors)
response_hash = {
success: false,
errors: {
email_language: ['Language cannot be blank'],
},
errors: nil,
error_details: {
email_language: { blank: true },
},
Expand All @@ -197,9 +195,7 @@
response = FormResponse.new(success: false, errors: errors)
response_hash = {
success: false,
errors: {
email_language: [t('errors.messages.blank')],
},
errors: nil,
error_details: {
email_language: { blank: true },
},
Expand Down Expand Up @@ -240,9 +236,7 @@
response = FormResponse.new(success: false, errors: errors)
response_hash = {
success: false,
errors: {
email_language: ['Language cannot be blank'],
},
errors: nil,
error_details: {
email_language: { blank: true },
},
Expand Down

0 comments on commit 37c882f

Please sign in to comment.