Sha256: cf4b768fa606972e490893d2cffa7d80058fae0f1b8d2ef4d39f354ee7dffed3

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 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_json(*args)
          attributes.to_json(*args)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
language_server-protocol-0.4.0 lib/language_server/protocol/interface/response_error.rb
language_server-protocol-0.3.0 lib/language_server/protocol/interface/response_error.rb