class PipeRpc::Hub::Message::ErrorResponse

Public Class Methods

new(hub, body) click to toggle source
Calls superclass method PipeRpc::ErrorResponse::new
# File lib/pipe_rpc/hub_message_error_response.rb, line 5
def initialize(hub, body)
  @hub = hub
  super body
end

Public Instance Methods

handle() click to toggle source
# File lib/pipe_rpc/hub_message_error_response.rb, line 18
def handle
  raise to_error
end
to_error() click to toggle source
# File lib/pipe_rpc/hub_message_error_response.rb, line 10
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