Class: Aikido::Errors::ApiError
- Inherits:
-
AikidoError
- Object
- Aikido::Errors::ApiError
- Defined in:
- lib/aikido/errors.rb
Overview
Represents an error that occurred while making an API request.
Instance Method Summary collapse
-
#initialize(response) ⇒ ApiError
constructor
A new instance of ApiError.
- #message ⇒ Object
Constructor Details
#initialize(response) ⇒ ApiError
Returns a new instance of ApiError.
9 10 11 12 |
# File 'lib/aikido/errors.rb', line 9 def initialize(response) @response = response super("API Error: #{response.status}") end |
Instance Method Details
#message ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/aikido/errors.rb', line 14 def json = @response.json if json.key?('error_description') "#{super} - #{json['error_description']}" elsif json.key?('reason_phrase') "#{super} - #{json['reason_phrase']}" else super end end |