Exception: ContentfulLite::Client::RequestError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/contentful_lite/client.rb

Direct Known Subclasses

NotFoundError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, body) ⇒ RequestError

Returns a new instance of RequestError.



8
9
10
11
12
# File 'lib/contentful_lite/client.rb', line 8

def initialize(response, body)
  @response = response
  @body = body
  super(body['sys'] && body['sys']['type'] == 'Error' ? "#{body['sys']['id']}: #{body['message']}" : "Invalid Contentful Response: #{body}")
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/contentful_lite/client.rb', line 6

def body
  @body
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/contentful_lite/client.rb', line 6

def response
  @response
end