Class: OpenC3::JsonRpcErrorResponse

Inherits:
JsonRpcResponse show all
Defined in:
lib/openc3/io/json_rpc.rb

Overview

Represents a JSON Remote Procedure Call Error Response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from JsonRpcResponse

from_json

Methods inherited from JsonRpc

#<=>, #as_json, #to_json

Constructor Details

#initialize(error, id) ⇒ JsonRpcErrorResponse



359
360
361
362
# File 'lib/openc3/io/json_rpc.rb', line 359

def initialize(error, id)
  super(id)
  @hash['error'.freeze] = error
end

Class Method Details

.from_hash(hash) ⇒ JsonRpcErrorResponse

Creates a JsonRpcErrorResponse object from a Hash



373
374
375
# File 'lib/openc3/io/json_rpc.rb', line 373

def self.from_hash(hash)
  self.new(JsonRpcError.from_hash(hash['error'.freeze]), hash['id'.freeze])
end

Instance Method Details

#errorJsonRpcError



365
366
367
# File 'lib/openc3/io/json_rpc.rb', line 365

def error
  @hash['error'.freeze]
end