Exception: EVSS::LoggedServiceException

Inherits:
ServiceException show all
Defined in:
lib/evss/logged_service_exception.rb

Direct Known Subclasses

PPIU::ServiceException

Instance Attribute Summary

Attributes inherited from ServiceException

#key, #messages

Instance Method Summary collapse

Methods inherited from ServiceException

#error_key, #messages_has_key?

Methods inherited from Common::Exceptions::BaseError

#errors, #i18n_data, #i18n_field, #i18n_interpolated, #i18n_key, #log_to_sentry?, #message, #sentry_type, #status_code

Constructor Details

#initialize(res_body, user, req_body = nil) ⇒ LoggedServiceException

Returns a new instance of LoggedServiceException.



7
8
9
10
11
# File 'lib/evss/logged_service_exception.rb', line 7

def initialize(res_body, user, req_body = nil)
  log_exception(res_body, user, req_body)

  super(res_body)
end

Instance Method Details

#log_exception(res_body, user, req_body) ⇒ Object (private)



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/evss/logged_service_exception.rb', line 15

def log_exception(res_body, user, req_body)
  # don't need to log GET exceptions, those are already logged to sentry with the response body saved
  return if req_body.blank?

  PersonalInformationLog.create(
    error_class: self.class.to_s,
    data: {
      user: {
        uuid: user.uuid,
        edipi: user.edipi,
        ssn: user.ssn
      },
      request: req_body,
      response: res_body
    }
  )
end