Exception: KintoBox::Error
- Inherits:
-
StandardError
- Object
- StandardError
- KintoBox::Error
- Defined in:
- lib/kinto_box/response_handler.rb
Overview
Base exception class for all API Client exceptions
Direct Known Subclasses
BadRequest, NotAllowed, NotAuthorized, NotFound, ServerError
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ Error
constructor
A new instance of Error.
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/kinto_box/response_handler.rb', line 4 def data @data end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/kinto_box/response_handler.rb', line 4 def response @response end |