Exception: Redd::APIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/redd/error.rb

Overview

An error with the API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ APIError

Returns a new instance of APIError.



11
12
13
14
15
# File 'lib/redd/error.rb', line 11

def initialize(response)
  @response = response
  @name, message = response.body[:json][:errors][0]
  super(message)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/redd/error.rb', line 9

def name
  @name
end

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/redd/error.rb', line 9

def response
  @response
end