class PipeRpc::PipeRpcErrorResponse
Attributes
code[R]
data[R]
id[R]
message[R]
Public Class Methods
new(args = {})
click to toggle source
# File lib/pipe_rpc/error_response.rb, line 3 def initialize(args = {}) @id = args.fetch(:id, nil) error = args.fetch(:error) @code = error.fetch(:code) @message = msg_for(@code) || error.fetch(:message, 'Unknown error') @data = error.fetch(:data, {}) end
Public Instance Methods
to_h()
click to toggle source
# File lib/pipe_rpc/error_response.rb, line 13 def to_h { id: id, error: { code: code, message: message, data: data } } end
Private Instance Methods
msg_for(code)
click to toggle source
# File lib/pipe_rpc/error_response.rb, line 19 def msg_for(code) case code when -32700 then 'Parse error' when -32600 then 'Invalid Request' when -32601 then 'Method not found' when -32602 then 'Invalid arguments' when -32603 then 'Internal error' when -32604 then 'Server not found' when -32605 then 'Reflected error' else nil end end