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

extract_google_rpc_status(status) click to toggle source
# File src/ruby/lib/grpc/google_rpc_status_utils.rb, line 28
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'
  return nil if status.metadata[grpc_status_details_bin_trailer].nil?
  Google::Rpc::Status.decode(status.metadata[grpc_status_details_bin_trailer])
end