class Jsonrpctcp::RPCError

A custom error for the library

Attributes

code[R]
message[R]
source_object[R]

Public Class Methods

from_rpc_response(r) click to toggle source

Creates a RPCError directly from a RPC response @param r [Hash] a parsed response

# File lib/jsonrpctcp/errors.rb, line 40
def self.from_rpc_response(r)
  if r.nil? || !r.is_a?(Hash)
    return RPCError.new("Empty response",
                        nil,
                        {})
  else
    return RPCError.new(r['error']['message'],
                        r['error']['code'],
                        r)
  end
end
new(message, code, source) click to toggle source

RPC erros allow quick access to the code, the message and the source error object returned by the server @param message [String] Error message @param code [Fixnum] Error code @param source [Hash] Original error object

# File lib/jsonrpctcp/errors.rb, line 32
def initialize(message, code, source)
  @code = code
  @message = message
  @source_object = hash
end