Exception: Bybit::ApiError

Inherits:
Error
  • Object
show all
Defined in:
lib/bybit/error.rb

Overview

Raised when the server returns HTTP 200 + retCode != 0 (the V5 norm), or when a transport-level error is enriched with a Bybit body payload.

Direct Known Subclasses

AuthError, RateLimitError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, http_status: nil) ⇒ ApiError

Returns a new instance of ApiError.



28
29
30
31
32
33
34
35
# File 'lib/bybit/error.rb', line 28

def initialize(response, http_status: nil)
  @ret_code    = response['retCode']
  @ret_msg     = response['retMsg']
  @result      = response['result']
  @time        = response['time']
  @http_status = http_status
  super("[#{@ret_code}] #{@ret_msg}")
end

Instance Attribute Details

#http_statusObject (readonly)

Returns the value of attribute http_status.



26
27
28
# File 'lib/bybit/error.rb', line 26

def http_status
  @http_status
end

#resultObject (readonly)

Returns the value of attribute result.



26
27
28
# File 'lib/bybit/error.rb', line 26

def result
  @result
end

#ret_codeObject (readonly)

Returns the value of attribute ret_code.



26
27
28
# File 'lib/bybit/error.rb', line 26

def ret_code
  @ret_code
end

#ret_msgObject (readonly)

Returns the value of attribute ret_msg.



26
27
28
# File 'lib/bybit/error.rb', line 26

def ret_msg
  @ret_msg
end

#timeObject (readonly)

Returns the value of attribute time.



26
27
28
# File 'lib/bybit/error.rb', line 26

def time
  @time
end