Exception: Pikuri::Lsp::Connection::ServerError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pikuri/lsp/connection.rb

Overview

A JSON-RPC error response. Not a bug in pikuri — the server understood the frame and refused the call.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, error) ⇒ ServerError

Returns a new instance of ServerError.

Parameters:

  • method (String)

    the request method that was refused.

  • error (Hash{String => Object})

    the error member.



87
88
89
90
91
# File 'lib/pikuri/lsp/connection.rb', line 87

def initialize(method, error)
  @code = error['code']
  @data = error['data']
  super("#{method} failed: #{error['message']} (code #{@code})")
end

Instance Attribute Details

#codeInteger (readonly)

Returns JSON-RPC error code, e.g. -32601 for Method not found.

Returns:

  • (Integer)

    JSON-RPC error code, e.g. -32601 for Method not found.



79
80
81
# File 'lib/pikuri/lsp/connection.rb', line 79

def code
  @code
end

#dataHash, ... (readonly)

Returns the data member, whose shape each server invents for itself.

Returns:

  • (Hash, Array, String, Numeric, nil)

    the data member, whose shape each server invents for itself.



83
84
85
# File 'lib/pikuri/lsp/connection.rb', line 83

def data
  @data
end