Exception: JRPC::Errors::ServerError

Inherits:
Error
  • Object
show all
Defined in:
lib/jrpc/errors.rb

Overview

A JSON-RPC error object the peer sent back, carrying its code and its optional data member verbatim. Per the spec data is "a primitive or structured value" defined by the server, so it arrives as whatever JSON.parse produced — String, Hash, Array, Numeric — or nil when the peer omitted it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code: nil, data: nil) ⇒ ServerError

Returns a new instance of ServerError.



21
22
23
24
25
# File 'lib/jrpc/errors.rb', line 21

def initialize(message, code: nil, data: nil)
  @code = code
  @data = data
  super(message)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



19
20
21
# File 'lib/jrpc/errors.rb', line 19

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



19
20
21
# File 'lib/jrpc/errors.rb', line 19

def data
  @data
end