Exception: CurrencyCloud::UnexpectedError

Inherits:
StandardError
  • Object
show all
Includes:
ErrorUtils
Defined in:
lib/currency_cloud/errors/unexpected_error.rb

Constant Summary

Constants included from ErrorUtils

ErrorUtils::REDACTED_PARAMS, ErrorUtils::REDACTED_STRING

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ErrorUtils

#platform, #redacted_params

Constructor Details

#initialize(verb, route, params, inner) ⇒ UnexpectedError

Returns a new instance of UnexpectedError.



7
8
9
10
11
12
# File 'lib/currency_cloud/errors/unexpected_error.rb', line 7

def initialize(verb, route, params, inner)
  @verb = verb
  @route = route
  @params = redacted_params(params)
  @inner_error = inner
end

Instance Attribute Details

#inner_errorObject (readonly)

Returns the value of attribute inner_error.



5
6
7
# File 'lib/currency_cloud/errors/unexpected_error.rb', line 5

def inner_error
  @inner_error
end

Instance Method Details

#to_sObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/currency_cloud/errors/unexpected_error.rb', line 14

def to_s
  class_name = super

  string_params = Hash[@params.map { |k, v| [k.to_s, v.to_s] }]

  error_details = {
    'platform' => platform,
    'request' => {
      'parameters' => string_params,
      'verb' => @verb.to_s,
      'url' => @route
    },
    'inner_error' => inner_error.to_s
  }
  "#{class_name}#{$INPUT_RECORD_SEPARATOR}#{YAML.dump(error_details)}"
end