Exception: Dato::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- Dato::ApiError
- Defined in:
- lib/dato/api_error.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(response) ⇒ ApiError
Returns a new instance of ApiError.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dato/api_error.rb', line 7 def initialize(response) body = JSON.parse(response[:body]) if response[:body] = [ "DatoCMS API Error", "Status: #{response[:status]}", "Response:", JSON.pretty_generate(body), ].join("\n") super() @response = response @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/dato/api_error.rb', line 5 def body @body end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/dato/api_error.rb', line 5 def response @response end |