Exception: Cryptomarket::APIException

Inherits:
SDKException
  • Object
show all
Defined in:
lib/cryptomarket/exceptions.rb

Overview

Exception representing an error from the server

Instance Attribute Summary collapse

Instance Method Summary collapse

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']
  raw_message = hash['message']
  @description = hash.key?('description') ? hash['description'] : ''
  @message = "#{self.class.name} (code=#{@code}): #{raw_message}. #{@description}"
  super
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



17
18
19
# File 'lib/cryptomarket/exceptions.rb', line 17

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



17
18
19
# File 'lib/cryptomarket/exceptions.rb', line 17

def description
  @description
end

#messageObject (readonly)

Returns the value of attribute message.



17
18
19
# File 'lib/cryptomarket/exceptions.rb', line 17

def message
  @message
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/cryptomarket/exceptions.rb', line 19

def to_s
  @message
end