Exception: Aptible::BillForward::ResponseError

Inherits:
Exception
  • Object
show all
Defined in:
lib/aptible/billforward/exceptions.rb

Direct Known Subclasses

ResourceNotFoundError

Instance Attribute Summary collapse

Attributes inherited from Exception

#cause

Instance Method Summary collapse

Constructor Details

#initialize(message, attrs = {}) ⇒ ResponseError

Returns a new instance of ResponseError.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/aptible/billforward/exceptions.rb', line 16

def initialize(message, attrs = {})
  self.response = attrs[:response]
  self.body = attrs[:body]

  if body.present? && body.key?(:errorMessage)
    error = body[:errorMessage]
    message = "#{message} (#{error})"
  elsif response
    message = "#{message} (\"#{response.inspect}\")"
  end

  super(message, attrs)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



14
15
16
# File 'lib/aptible/billforward/exceptions.rb', line 14

def body
  @body
end

#responseObject

Returns the value of attribute response.



13
14
15
# File 'lib/aptible/billforward/exceptions.rb', line 13

def response
  @response
end