Class: BenefitsClaims::ServiceException
- Inherits:
-
Object
- Object
- BenefitsClaims::ServiceException
- Includes:
- SentryLogging
- Defined in:
- lib/lighthouse/benefits_claims/service_exception.rb
Overview
Custom exception that maps Benefits Claims errors to error details defined in config/locales/exceptions.en.yml
Constant Summary collapse
- ERROR_MAP =
{ 504 => Common::Exceptions::GatewayTimeout, 503 => Common::Exceptions::ServiceUnavailable, 502 => Common::Exceptions::BadGateway, 500 => Common::Exceptions::ExternalServerInternalServerError, 429 => Common::Exceptions::TooManyRequests, 422 => Common::Exceptions::UnprocessableEntity, 413 => Common::Exceptions::PayloadTooLarge, 404 => Common::Exceptions::ResourceNotFound, 403 => Common::Exceptions::Forbidden, 401 => Common::Exceptions::Unauthorized, 400 => Common::Exceptions::BadRequest }.freeze
Instance Method Summary collapse
-
#initialize(e) ⇒ ServiceException
constructor
A new instance of ServiceException.
- #raise_exception(status) ⇒ Object
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Constructor Details
#initialize(e) ⇒ ServiceException
Returns a new instance of ServiceException.
25 26 27 28 29 30 |
# File 'lib/lighthouse/benefits_claims/service_exception.rb', line 25 def initialize(e) raise e unless e.key?(:status) status = e[:status].to_i raise_exception(status) end |