Exception: DecisionReview::ServiceException
- Inherits:
-
Common::Exceptions::BackendServiceException
- Object
- StandardError
- Common::Exceptions::BaseError
- Common::Exceptions::BackendServiceException
- DecisionReview::ServiceException
- Includes:
- SentryLogging
- Defined in:
- lib/decision_review/service_exception.rb
Overview
Custom exception that maps Decision Review errors to error details defined in config/locales/exceptions.en.yml
Constant Summary collapse
- UNMAPPED_KEY =
'unmapped_service_exception'
Instance Attribute Summary
Attributes inherited from Common::Exceptions::BackendServiceException
#key, #original_body, #original_status, #response_values
Instance Method Summary collapse
- #code ⇒ Object private
- #i18n_key ⇒ Object private
-
#initialize(key: UNMAPPED_KEY, response_values: {}, original_status: nil, original_body: nil) ⇒ ServiceException
constructor
A new instance of ServiceException.
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Methods inherited from Common::Exceptions::BackendServiceException
#detail, #errors, #message, #render_overides, #source, #status, #va900?, #va900_hint, #va900_warning, #validate_arguments!
Methods inherited from Common::Exceptions::BaseError
#errors, #i18n_data, #i18n_field, #i18n_interpolated, #log_to_sentry?, #message, #sentry_type, #status_code
Constructor Details
#initialize(key: UNMAPPED_KEY, response_values: {}, original_status: nil, original_body: nil) ⇒ ServiceException
Returns a new instance of ServiceException.
13 14 15 |
# File 'lib/decision_review/service_exception.rb', line 13 def initialize(key: UNMAPPED_KEY, response_values: {}, original_status: nil, original_body: nil) super(key, response_values, original_status, original_body) end |
Instance Method Details
#code ⇒ Object (private)
19 20 21 22 23 24 25 |
# File 'lib/decision_review/service_exception.rb', line 19 def code if @key.present? && I18n.exists?("decision_review.exceptions.#{@key}") @key else UNMAPPED_KEY end end |
#i18n_key ⇒ Object (private)
27 28 29 |
# File 'lib/decision_review/service_exception.rb', line 27 def i18n_key "decision_review.exceptions.#{code}" end |