Sha256: c3a687425e66e3acae4804c9d48e60327add72166f472be72a6471ab03829939

Contents?: true

Size: 1.66 KB

Versions: 1

Compression:

Stored size: 1.66 KB

Contents

# frozen_string_literal: true

module ViaBTC
  module Error
    # ViaBTC Module Error Classes
    ViaBTCError      = Class.new(StandardError)  # Module Base Error Class
    Configuration    = Class.new(ViaBTCError)    # Module Config Error
    InvalidParameter = Class.new(ViaBTCError)    # Module Invalid Param Error

    # ViaBTC Exchange Server Base Error Class
    class ExchangeError < StandardError
      attr_reader :response
      def initialize(response)
        @code = response['error']['code']
        @message = response['error']['message']
        @response = response
      end
    end

    # ViaBTC Exchange Server General Error Codes
    InvalidArgument       = Class.new(ExchangeError)  #  1: Invalid Argument
    InternalError         = Class.new(ExchangeError)  #  2: Internal Error
    ServiceUnavailable    = Class.new(ExchangeError)  #  3: Service Unavailable
    MethodNotFound        = Class.new(ExchangeError)  #  4: Method Not Found
    ServiceTimeout        = Class.new(ExchangeError)  #  5: Service Timeout
    RequireAuthentication = Class.new(ExchangeError)  #  6: Require Authentication

    # ViaBTC Exchange Server Undocumented Error Codes with Gotchas

    # matchengine/me_server.c: on_cmd_order_put_limit
    LimitOrderBalanceNotEnough = Class.new(ExchangeError)  # 10: Balance Not Enough
    LimitOrderAmountTooSmall   = Class.new(ExchangeError)  # 11: Amount Too Small
    LimitOrderNoEnoughTrader   = Class.new(ExchangeError)  # 12: No Enough Trader

    # matchengine/me_server.c: on_cmd_balance_update
    RepeatBalanceUpdate = Class.new(ExchangeError)  # 10: Repeat Update
    BalanceNotEnough    = Class.new(ExchangeError)  # 11: Balance Not Enough
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
viabtc-1.3.0 lib/viabtc/error.rb