Sha256: af28038a13d5a0baa29d512199821fa6cda7bca20a356c12859971a283a4b0db

Contents?: true

Size: 423 Bytes

Versions: 4

Compression:

Stored size: 423 Bytes

Contents

module Deribit
  class Error < StandardError
    attr_reader :code, :msg

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

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

    def message
      inspect
    end

    def to_s
      inspect
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
deribit-v2-2.1.0 lib/deribit/error.rb
deribit-v2-2.0.0 lib/deribit/error.rb
deribit-1.4.3 lib/deribit/error.rb
deribit-1.3.2 lib/deribit/error.rb