Exception: FbGraph::Exception

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message, body = '') ⇒ Exception

Returns a new instance of Exception.



16
17
18
19
20
21
22
23
24
25
# File 'lib/fb_graph.rb', line 16

def initialize(code, message, body = '')
  @code = code
  if body.blank?
    @message = message
  else
    response = JSON.parse(body).with_indifferent_access
    @message = response[:error][:message]
    @type = response[:error][:type]
  end
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



15
16
17
# File 'lib/fb_graph.rb', line 15

def code
  @code
end

#messageObject

Returns the value of attribute message.



15
16
17
# File 'lib/fb_graph.rb', line 15

def message
  @message
end

#typeObject

Returns the value of attribute type.



15
16
17
# File 'lib/fb_graph.rb', line 15

def type
  @type
end