Exception: Agave::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- Agave::ApiError
- Defined in:
- lib/agave/api_error.rb
Instance Attribute Summary collapse
-
#faraday_error ⇒ Object
readonly
Returns the value of attribute faraday_error.
Instance Method Summary collapse
- #body ⇒ Object
-
#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/agave/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/agave/api_error.rb', line 4 def faraday_error @faraday_error end |
Instance Method Details
#body ⇒ Object
19 20 21 |
# File 'lib/agave/api_error.rb', line 19 def body JSON.parse(faraday_error.response[:body]) end |
#message ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/agave/api_error.rb', line 10 def [ 'AgaveCMS API Error', "Status: #{faraday_error.response[:status]}", 'Response:', JSON.pretty_generate(body) ].join("\n") end |