Exception: JsonRpcClient::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/json-rpc-client.rb

Overview

This class corresponds to the JSON-RPC error object gotten from the server. A “faked” instance of this will be thrown for communication errors as well.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, code, data) ⇒ Error

Returns a new instance of Error.



182
183
184
185
186
# File 'lib/json-rpc-client.rb', line 182

def initialize(msg, code, data)
  super(msg)
  @code = code
  @data = data
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



181
182
183
# File 'lib/json-rpc-client.rb', line 181

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



181
182
183
# File 'lib/json-rpc-client.rb', line 181

def data
  @data
end

Instance Method Details

#inspectString

Returns the contents of the current error object as a string.

Returns:

  • (String)


192
193
194
# File 'lib/json-rpc-client.rb', line 192

def inspect
  %|#{self.class}: #{self.message}, code: #{@code.inspect}, data: #{@data.inspect}|
end