Exception: RestClient::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rest_client/api_error.rb

Direct Known Subclasses

NotFoundError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ApiError

Returns a new instance of ApiError.



16
17
18
19
# File 'lib/rest_client/api_error.rb', line 16

def initialize(response)
  @response = response
  super(response.error_message)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/rest_client/api_error.rb', line 5

def response
  @response
end

Class Method Details

.[](code) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/rest_client/api_error.rb', line 7

def self.[](code)
  case code
  when 404
    NotFoundError
  else
    ApiError
  end
end