Exception: WCC::Contentful::SimpleClient::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/wcc/contentful/simple_client/response.rb

Direct Known Subclasses

NotFoundError, RateLimitError, UnauthorizedError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ApiError

Returns a new instance of ApiError.



210
211
212
213
# File 'lib/wcc/contentful/simple_client/response.rb', line 210

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

Instance Attribute Details

#responseObject (readonly)



195
196
197
# File 'lib/wcc/contentful/simple_client/response.rb', line 195

def response
  @response
end

Class Method Details

.[](code) ⇒ Object



197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/wcc/contentful/simple_client/response.rb', line 197

def self.[](code)
  case code
  when 404
    NotFoundError
  when 401
    UnauthorizedError
  when 429
    RateLimitError
  else
    ApiError
  end
end