Module: FailedRequestLoggable
- Extended by:
- ActiveSupport::Concern
- Included in:
- AppealsBaseController, AppealsBaseControllerV1
- Defined in:
- app/controllers/concerns/failed_request_loggable.rb
Instance Method Summary collapse
- #current_user_hash ⇒ Object private
- #log_exception_to_personal_information_log(exception, error_class:, **additional_data) ⇒ Object private
Instance Method Details
#current_user_hash ⇒ Object (private)
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/concerns/failed_request_loggable.rb', line 27 def current_user_hash hash = {} %i[first_name last_name birls_id icn edipi mhv_correlation_id participant_id vet360_id ssn] .each { |key| hash[key] = @current_user.try(key) } hash[:assurance_level] = begin @current_user.loa[:current] rescue nil end hash[:birth_date] = begin @current_user.birth_date_mpi.to_date.iso8601 rescue nil end hash end |
#log_exception_to_personal_information_log(exception, error_class:, **additional_data) ⇒ Object (private)
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/concerns/failed_request_loggable.rb', line 48 def log_exception_to_personal_information_log(exception, error_class:, **additional_data) data = { user: current_user_hash, error: self.class.exception_hash(exception) } data[:additional_data] = additional_data if additional_data.present? begin PersonalInformationLog.create!(error_class:, data:) rescue => e # Not sure if the error message could include PII # so just logging the backtrace as it would still tell us if there's a validation error or something Rails.logger.error('PersonalInformationLog error backtrace', e.backtrace) raise end end |