Method: GRPC::BadStatus#to_rpc_status

Defined in:
src/ruby/lib/grpc/errors.rb

#to_rpc_statusGoogle::Rpc::Status?

Converts the exception to a deserialized Google::Rpc::Status object. Returns nil if the grpc-status-details-bin trailer could not be converted to a Google::Rpc::Status due to the server not providing the necessary trailers.

Returns:

  • (Google::Rpc::Status, nil)


69
70
71
72
73
74
75
# File 'src/ruby/lib/grpc/errors.rb', line 69

def to_rpc_status
  GoogleRpcStatusUtils.extract_google_rpc_status(to_status)
rescue Google::Protobuf::ParseError => parse_error
  GRPC.logger.warn('parse error: to_rpc_status failed')
  GRPC.logger.warn(parse_error)
  nil
end