class GRPC::GoogleRpcStatusUtils
GoogleRpcStatusUtils
provides utilities to convert between a GRPC::Core::Status and a deserialized Google::Rpc::Status proto Returns nil if the grpc-status-details-bin trailer could not be converted to a GoogleRpcStatus due to the server not providing the necessary trailers. Raises an error if the server did provide the necessary trailers but they fail to deseriliaze into a GoogleRpcStatus protobuf.
Public Class Methods
Source
# File src/ruby/lib/grpc/google_rpc_status_utils.rb, line 27 def self.extract_google_rpc_status(status) fail ArgumentError, 'bad type' unless status.is_a? Struct::Status grpc_status_details_bin_trailer = 'grpc-status-details-bin' binstatus = status.metadata[grpc_status_details_bin_trailer] return nil if binstatus.nil? # Lazily load grpc_c and protobuf_c.so for users of this method. require_relative './grpc' require 'google/rpc/status_pb' Google::Rpc::Status.decode(binstatus) end