Exception: Cryptomarket::APIException
- Inherits:
-
SDKException
- Object
- StandardError
- SDKException
- Cryptomarket::APIException
- Defined in:
- lib/cryptomarket/exceptions.rb
Overview
Exception representing an error from the server
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(hash) ⇒ APIException
constructor
A new instance of APIException.
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ APIException
Returns a new instance of APIException.
9 10 11 12 13 14 15 |
# File 'lib/cryptomarket/exceptions.rb', line 9 def initialize(hash) @code = hash['code'] = hash['message'] @description = hash.key?('description') ? hash['description'] : '' @message = "#{self.class.name} (code=#{@code}): #{}. #{@description}" super end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
17 18 19 |
# File 'lib/cryptomarket/exceptions.rb', line 17 def code @code end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
17 18 19 |
# File 'lib/cryptomarket/exceptions.rb', line 17 def description @description end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
17 18 19 |
# File 'lib/cryptomarket/exceptions.rb', line 17 def @message end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/cryptomarket/exceptions.rb', line 19 def to_s @message end |