Method: Adyen::REST::ResponseError#initialize

Defined in:
lib/adyen/rest/errors.rb

#initialize(response_body) ⇒ ResponseError

Returns a new instance of ResponseError.



23
24
25
26
27
28
29
30
# File 'lib/adyen/rest/errors.rb', line 23

def initialize(response_body)
  if match = /\A(\w+)\s(\d+)\s(.*)\z/.match(response_body)
    @category, @code, @description = match[1], match[2].to_i, match[3]
    super("API request error: #{description} (code: #{code}/#{category})")
  else
    super("API request error: #{response_body}")
  end
end