Exception: RubynCode::IDE::Protocol::JsonRpcError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rubyn_code/ide/protocol.rb

Overview

Raise from a handler to emit a JSON-RPC error response with a specific code. The dispatcher catches this and converts it to a proper ‘error` envelope — handlers don’t have to know how to write to the wire. Use this instead of returning ‘{ ’error’ => … }‘ as the handler result, which the dispatcher would otherwise serialize as a successful `result` payload (the very bug this class fixes).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message) ⇒ JsonRpcError

Returns a new instance of JsonRpcError.



33
34
35
36
# File 'lib/rubyn_code/ide/protocol.rb', line 33

def initialize(code, message)
  super(message)
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



31
32
33
# File 'lib/rubyn_code/ide/protocol.rb', line 31

def code
  @code
end