Class: PipeRpc::Hub::Message::ErrorResponse
Instance Attribute Summary
#code, #data, #id, #message
Instance Method Summary
collapse
#to_h
Constructor Details
Returns a new instance of ErrorResponse.
5
6
7
8
|
# File 'lib/pipe_rpc/hub_message_error_response.rb', line 5
def initialize(hub, body)
@hub = hub
super body
end
|
Instance Method Details
18
19
20
|
# File 'lib/pipe_rpc/hub_message_error_response.rb', line 18
def handle
raise to_error
end
|
10
11
12
13
14
15
16
|
# 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
|