Exception: QaddyClient::Errors::ErrorWithResponse

Inherits:
Error
  • Object
show all
Defined in:
lib/qaddy_client/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, response) ⇒ ErrorWithResponse

Returns a new instance of ErrorWithResponse.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/qaddy_client/errors.rb', line 10

def initialize(message, response)
  super message
  @response = response
  @code = response.code
  @result = response.body

  begin
    @result = JSON.parse(@result)
  rescue
    # leave non-JSON body as is
  end
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



7
8
9
# File 'lib/qaddy_client/errors.rb', line 7

def code
  @code
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/qaddy_client/errors.rb', line 6

def response
  @response
end

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/qaddy_client/errors.rb', line 8

def result
  @result
end