Exception: Zabby::APIError
- Inherits:
-
StandardError
- Object
- StandardError
- Zabby::APIError
- Defined in:
- lib/zabby/exceptions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
Instance Method Summary collapse
-
#initialize(msg, code = nil, data = nil) ⇒ APIError
constructor
A new instance of APIError.
- #message ⇒ Object
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
#code ⇒ Object (readonly)
Returns the value of attribute code.
8 9 10 |
# File 'lib/zabby/exceptions.rb', line 8 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/zabby/exceptions.rb', line 8 def data @data end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
8 9 10 |
# File 'lib/zabby/exceptions.rb', line 8 def msg @msg end |
Instance Method Details
#message ⇒ Object
16 17 18 19 20 21 |
# File 'lib/zabby/exceptions.rb', line 16 def text = "#{msg}" text += ": #{data}" if data text += " (code: #{code})" if code text end |