Sha256: 4331e7777be3a7c8ae6b4874da1a1a7e8247f08963622b38b934b286749e419f

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class ResponseError
        def initialize(code:, message:, data: nil)
          @attributes = {}

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

          @attributes.freeze
        end

        #
        # A number indicating the error type that occurred.
        #
        # @return [number]
        def code
          attributes.fetch(:code)
        end

        #
        # A string providing a short description of the error.
        #
        # @return [string]
        def message
          attributes.fetch(:message)
        end

        #
        # A Primitive or Structured value that contains additional
        # information about the error. Can be omitted.
        #
        # @return [D]
        def data
          attributes.fetch(:data)
        end

        attr_reader :attributes

        def to_hash
          attributes
        end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
language_server-protocol-3.14.0.2 lib/language_server/protocol/interface/response_error.rb
language_server-protocol-3.14.0.1 lib/language_server/protocol/interface/response_error.rb
language_server-protocol-3.14.0.0 lib/language_server/protocol/interface/response_error.rb
language_server-protocol-3.12.0.0 lib/language_server/protocol/interface/response_error.rb
language_server-protocol-3.7.0.0 lib/language_server/protocol/interface/response_error.rb
language_server-protocol-0.5.0 lib/language_server/protocol/interface/response_error.rb