class Struct::BatchResult

BatchResult is the struct returned by calls to call#start_batch.

Public Instance Methods

check_status() click to toggle source

check_status returns the status, raising an error if the status is non-nil and not OK.

# File src/ruby/lib/grpc/generic/active_call.rb, line 24
def check_status
  return nil if status.nil?
  fail GRPC::Cancelled if status.code == GRPC::Core::StatusCodes::CANCELLED
  if status.code != GRPC::Core::StatusCodes::OK
    GRPC.logger.debug("Failing with status #{status}")
    # raise BadStatus, propagating the metadata if present.
    md = status.metadata
    fail GRPC::BadStatus.new_status_exception(
      status.code, status.details, md)
  end
  status
end