Sha256: 4be4941a09ff02c5c5e7051497c9251ff661420ea11d1d942548b2007a188743

Contents?: true

Size: 464 Bytes

Versions: 13

Compression:

Stored size: 464 Bytes

Contents

class PipeRpc::ErrorResponse; end

module PipeRpc
  class Hub::Message::ErrorResponse < ErrorResponse
    def initialize(hub, body)
      @hub = hub
      super body
    end

    def to_error
      case @code
      when -32700 then MessageParseError.new(@data.fetch(:message))
      when -32600 then InvalidMessageError.new(@data.fetch(:message))
      else UnknownError.new(@data[:message])
      end
    end

    def handle
      raise to_error
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pipe_rpc-2.5.0 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-2.4.0 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-2.3.0 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-2.2.3 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-2.2.2 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-2.2.1 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-2.2.0 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-2.1.0 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-2.0.0 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-1.1.2 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-1.1.1 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-1.1.0 lib/pipe_rpc/hub_message_error_response.rb
pipe_rpc-1.0.0 lib/pipe_rpc/hub_message_error_response.rb