Exception: Sesame::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, data) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
# File 'lib/sesame/error.rb', line 5

def initialize(status, data)
  super(data['message'])
  @data = data
  @status = status
  @code = data['code'].to_i
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/sesame/error.rb', line 3

def code
  @code
end

#statusObject (readonly)

Returns the value of attribute status.



3
4
5
# File 'lib/sesame/error.rb', line 3

def status
  @status
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/sesame/error.rb', line 12

def to_s
  %(#{@data['message']} HTTP: #{status}, API: #{@data['code']})
end