Exception: KintoBox::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/kinto_box/response_handler.rb

Overview

Base exception class for all API Client exceptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
11
12
13
14
# File 'lib/kinto_box/response_handler.rb', line 5

def initialize(response)
  @response = response
  @data ||= begin
    JSON.parse(response.body)
  rescue
    {}
  end

  super("#{response.code} #{response.request.uri} #{response.body}")
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/kinto_box/response_handler.rb', line 4

def data
  @data
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/kinto_box/response_handler.rb', line 4

def response
  @response
end