Class: LanguageServer::Protocol::Interfaces::ResponseError

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interfaces/response_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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



5
6
7
8
9
10
11
12
13
# File 'lib/language_server/protocol/interfaces/response_error.rb', line 5

def initialize(code:, message:, data: nil)
  @attributes = {}

  @attributes[:code] = code
  @attributes[:message] = message
  @attributes[:data] = data if data

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



40
41
42
# File 'lib/language_server/protocol/interfaces/response_error.rb', line 40

def attributes
  @attributes
end

Instance Method Details

#codenumber

A number indicating the error type that occurred.



19
20
21
# File 'lib/language_server/protocol/interfaces/response_error.rb', line 19

def code
  attributes.fetch(:code)
end

#dataD

A Primitive or Structured value that contains additional information about the error. Can be omitted.



36
37
38
# File 'lib/language_server/protocol/interfaces/response_error.rb', line 36

def data
  attributes.fetch(:data)
end

#messagestring

A string providing a short description of the error.



27
28
29
# File 'lib/language_server/protocol/interfaces/response_error.rb', line 27

def message
  attributes.fetch(:message)
end

#to_json(*args) ⇒ Object



42
43
44
# File 'lib/language_server/protocol/interfaces/response_error.rb', line 42

def to_json(*args)
  attributes.to_json(*args)
end