Exception: Zabby::APIError

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

Direct Known Subclasses

AuthenticationError, ResponseCodeError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, code = nil, data = nil) ⇒ APIError

Returns a new instance of APIError.



10
11
12
13
14
# File 'lib/zabby/exceptions.rb', line 10

def initialize(msg, code = nil, data = nil)
  @msg = msg
  @code = code
  @data = data
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#msgObject (readonly)

Returns the value of attribute msg.



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

def msg
  @msg
end

Instance Method Details

#messageObject



16
17
18
19
20
21
# File 'lib/zabby/exceptions.rb', line 16

def message
  text = "#{msg}"
  text += ": #{data}" if data
  text += " (code: #{code})" if code
  text
end