Exception: WCC::API::RestClient::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/wcc/api/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.



17
18
19
20
# File 'lib/wcc/api/rest_client/api_error.rb', line 17

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

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/wcc/api/rest_client/api_error.rb', line 6

def response
  @response
end

Class Method Details

.[](code) ⇒ Object



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

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