aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpp/proto/proto_utils.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc
index 268e4f6d1f..7b2a65e99b 100644
--- a/src/cpp/proto/proto_utils.cc
+++ b/src/cpp/proto/proto_utils.cc
@@ -154,13 +154,16 @@ namespace grpc {
Status SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) {
GrpcBufferWriter writer(bp);
- return msg.SerializeToZeroCopyStream(&writer) ? Status::OK : Status(INVALID_ARGUMENT, "Failed to serialize message");
+ return msg.SerializeToZeroCopyStream(&writer)
+ ? Status::OK
+ : Status(StatusCode::INVALID_ARGUMENT,
+ "Failed to serialize message");
}
Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
int max_message_size) {
if (!buffer) {
- return Status(INVALID_ARGUMENT, "No payload");
+ return Status(StatusCode::INVALID_ARGUMENT, "No payload");
}
GrpcBufferReader reader(buffer);
::grpc::protobuf::io::CodedInputStream decoder(&reader);
@@ -168,10 +171,11 @@ Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
decoder.SetTotalBytesLimit(max_message_size, max_message_size);
}
if (!msg->ParseFromCodedStream(&decoder)) {
- return Status(INVALID_ARGUMENT, msg->InitializationErrorString());
+ return Status(StatusCode::INVALID_ARGUMENT,
+ msg->InitializationErrorString());
}
if (!decoder.ConsumedEntireMessage()) {
- return Status(INVALID_ARGUMENT, "Did not read entire message");
+ return Status(StatusCode::INVALID_ARGUMENT, "Did not read entire message");
}
return Status::OK;
}