From 2dbbbed9d4e3712e42c2a8849f21ca270c3bbcef Mon Sep 17 00:00:00 2001 From: Alisha Nanda Date: Tue, 4 May 2021 00:12:16 +0000 Subject: [PATCH] Added additional logging for serialization failure --- include/grpcpp/impl/codegen/proto_utils.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/grpcpp/impl/codegen/proto_utils.h b/include/grpcpp/impl/codegen/proto_utils.h index 838715e14d9..262da59ede5 100644 --- a/include/grpcpp/impl/codegen/proto_utils.h +++ b/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.