Added additional logging for serialization failure

pull/26159/head
Alisha Nanda 4 years ago
parent 31f4e6e3c8
commit 2dbbbed9d4
No known key found for this signature in database
GPG Key ID: FAFBAD4BF438BC17
  1. 9
      include/grpcpp/impl/codegen/proto_utils.h

@ -61,9 +61,12 @@ Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb,
return g_core_codegen_interface->ok();
}
ProtoBufferWriter writer(bb, kProtoBufferWriterMaxBufferLength, byte_size);
return msg.SerializeToZeroCopyStream(&writer)
? g_core_codegen_interface->ok()
: Status(StatusCode::INTERNAL, "Failed to serialize message");
if (msg.SerializeToZeroCopyStream(&writer)) {
return g_core_codegen_interface->ok();
} else {
gpr_log(GPR_ERROR, "Failed to serialize message");
return Status(StatusCode::INTERNAL, "Failed to serialize message");
}
}
// BufferReader must be a subclass of ::protobuf::io::ZeroCopyInputStream.

Loading…
Cancel
Save