Sha256: 45429f82b2d74fcb20a11720cf6512d12654a60cad16445c753377c4a182924e
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
class PipeRpc::ErrorResponse; end module PipeRpc class Client::Request::ErrorResponse < ErrorResponse def initialize(request, body) @request = request super body end def to_result case @code when -32601 then no_method_error when -32602 then argument_error when -32603 then internal_error when -32604 then no_server_error when -32605 then reflected_error else unknown_error end end private def no_method_error NoMethodError.new("undefined method `#{@data.fetch(:method)}' for #{@request.server}") end def argument_error ArgumentError.new(@data.fetch(:message)) end def no_server_error NoServerError.new("undefined server `#{@request.server}'") end def internal_error InternalError.new(@data[:message]).tap do |error| error.set_backtrace(@data[:backtrace]) if error.respond_to? :set_backtrace end end def reflected_error ReflectedError.new(@data[:message]).tap do |error| error.set_backtrace(@data[:backtrace]) if error.respond_to? :set_backtrace end end def unknown_error UnknownError.new(@data[:message]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pipe_rpc-2.5.0 | lib/pipe_rpc/client_request_error_response.rb |