Class: BenefitsReferenceData::ServiceException

Inherits:
Object
  • Object
show all
Includes:
SentryLogging
Defined in:
lib/lighthouse/benefits_reference_data/service_exception.rb

Overview

Custom exception that maps Decision Review errors to error details defined in config/locales/exceptions.en.yml

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Constructor Details

#initialize(e) ⇒ ServiceException

Returns a new instance of ServiceException.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lighthouse/benefits_reference_data/service_exception.rb', line 11

def initialize(e)
  raise e unless e.respond_to?(:status)

  case e.status.to_i
  when 404
    raise Common::Exceptions::ResourceNotFound
  when 403
    raise Common::Exceptions::Forbidden
  else
    raise e
  end
end