#include "grpc++/support/byte_buffer.h"
#include "tensorflow/core/distributed_runtime/tensor_coding.h"
#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/lib/strings/stringprintf.h"
#include "tensorflow/core/platform/mutex.h"
#include "tensorflow/core/platform/protobuf.h"
if (s.ok()) {
return ::grpc::Status::OK;
} else {
+ if (s.error_message().size() > 3072 /* 3k bytes */) {
+ // TODO(b/62947679): Remove truncation once the gRPC issue is resolved.
+ string scratch =
+ strings::Printf("%.3072s ... [truncated]", s.error_message().c_str());
+ LOG(ERROR) << "Truncated error message: " << s;
+ return ::grpc::Status(static_cast<::grpc::StatusCode>(s.code()), scratch);
+ }
return ::grpc::Status(static_cast<::grpc::StatusCode>(s.code()),
s.error_message());
}