Sha256: e6eed511658f3a38d4cd6a87f54ede76f46744dca8f40044bcd200441aceeab1

Contents?: true

Size: 1.6 KB

Versions: 13

Compression:

Stored size: 1.6 KB

Contents

# typed: strict
# frozen_string_literal: true

module Spoom
  module LSP
    class Error < StandardError
      class AlreadyOpen < Error; end
      class BadHeaders < Error; end

      class Diagnostics < Error
        extend T::Sig

        sig { returns(String) }
        attr_reader :uri

        sig { returns(T::Array[Diagnostic]) }
        attr_reader :diagnostics

        class << self
          extend T::Sig

          sig { params(json: T::Hash[T.untyped, T.untyped]).returns(Diagnostics) }
          def from_json(json)
            Diagnostics.new(
              json["uri"],
              json["diagnostics"].map { |d| Diagnostic.from_json(d) },
            )
          end
        end

        sig { params(uri: String, diagnostics: T::Array[Diagnostic]).void }
        def initialize(uri, diagnostics)
          @uri = uri
          @diagnostics = diagnostics
          super()
        end
      end
    end

    class ResponseError < Error
      extend T::Sig

      sig { returns(Integer) }
      attr_reader :code

      sig { returns(T::Hash[T.untyped, T.untyped]) }
      attr_reader :data

      class << self
        extend T::Sig

        sig { params(json: T::Hash[T.untyped, T.untyped]).returns(ResponseError) }
        def from_json(json)
          ResponseError.new(
            json["code"],
            json["message"],
            json["data"],
          )
        end
      end

      sig { params(code: Integer, message: String, data: T::Hash[T.untyped, T.untyped]).void }
      def initialize(code, message, data)
        super(message)
        @code = code
        @data = data
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
spoom-1.3.2 lib/spoom/sorbet/lsp/errors.rb
spoom-1.3.1 lib/spoom/sorbet/lsp/errors.rb
spoom-1.3.0 lib/spoom/sorbet/lsp/errors.rb
spoom-1.2.4 lib/spoom/sorbet/lsp/errors.rb
spoom-1.2.3 lib/spoom/sorbet/lsp/errors.rb
spoom-1.2.2 lib/spoom/sorbet/lsp/errors.rb
spoom-1.2.1 lib/spoom/sorbet/lsp/errors.rb
spoom-1.2.0 lib/spoom/sorbet/lsp/errors.rb
spoom-1.1.16 lib/spoom/sorbet/lsp/errors.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/spoom-1.1.15/lib/spoom/sorbet/lsp/errors.rb
spoom-1.1.15 lib/spoom/sorbet/lsp/errors.rb
spoom-1.1.14 lib/spoom/sorbet/lsp/errors.rb
spoom-1.1.13 lib/spoom/sorbet/lsp/errors.rb