Exception: Deribit::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code: nil, json: {}, message: nil) ⇒ Error

Returns a new instance of Error.



5
6
7
8
# File 'lib/deribit/error.rb', line 5

def initialize(code: nil, json: {}, message: nil)
  @code = code || json[:code]
  @msg = message || json[:msg]
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

#msgObject (readonly)

Returns the value of attribute msg.



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

def msg
  @msg
end

Instance Method Details

#inspectObject



10
11
12
13
14
# File 'lib/deribit/error.rb', line 10

def inspect
  message = ""
  message += "(#{code}) " unless code.nil?
  message += "#{msg}" unless msg.nil?
end

#messageObject



16
17
18
# File 'lib/deribit/error.rb', line 16

def message
  inspect
end

#to_sObject



20
21
22
# File 'lib/deribit/error.rb', line 20

def to_s
  inspect
end