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.



9
10
11
12
13
14
15
16
17
18
# File 'lib/fb_graph.rb', line 9

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.



8
9
10
# File 'lib/fb_graph.rb', line 8

def code
  @code
end

#messageObject

Returns the value of attribute message.



8
9
10
# File 'lib/fb_graph.rb', line 8

def message
  @message
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/fb_graph.rb', line 8

def type
  @type
end