Exception: EVSS::IntentToFile::ServiceException

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

Overview

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

Constant Summary collapse

ERROR_MAP =
{
  'partner.service.error' => 'evss.intent_to_file.partner_service_error',
  'service.error' => 'evss.intent_to_file.internal_service_error',
  'intentType.invalid' => 'evss.intent_to_file.intent_type_invalid',
  'partner.service.invalid' => 'evss.intent_to_file.partner_service_invalid',
  'default' => 'common.exceptions.internal_server_error'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ServiceException

#initialize

Methods inherited from Common::Exceptions::BaseError

#log_to_sentry?, #message, #sentry_type, #status_code

Constructor Details

This class inherits a constructor from EVSS::ServiceException

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



19
20
21
# File 'lib/evss/intent_to_file/service_exception.rb', line 19

def key
  @key
end

#messagesObject (readonly)

Returns the value of attribute messages.



19
20
21
# File 'lib/evss/intent_to_file/service_exception.rb', line 19

def messages
  @messages
end

Instance Method Details

#errorsObject



21
22
23
24
25
26
27
# File 'lib/evss/intent_to_file/service_exception.rb', line 21

def errors
  Array(
    Common::Exceptions::SerializableError.new(
      i18n_data.merge(source: 'EVSS::IntentToFile::Service', meta: { messages: @messages })
    )
  )
end