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