Exception: FbGraph::Exception

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

Direct Known Subclasses

NotFound, Unauthorized

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Exception.



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

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.



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

def code
  @code
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end