Simpler ClientJson::send.
GitOrigin-RevId: 5f992052b2ac11385caee32d7dacc799036170cf
This commit is contained in:
parent
68dd5cece9
commit
82df6d7625
@ -67,13 +67,13 @@ CSlice ClientJson::store_string(std::string str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClientJson::send(Slice request) {
|
void ClientJson::send(Slice request) {
|
||||||
auto status = [&] {
|
auto r_request = to_request(request);
|
||||||
TRY_RESULT(client_request, to_request(request));
|
if (r_request.is_error()) {
|
||||||
client_.send(std::move(client_request));
|
LOG(ERROR) << "Failed to parse " << tag("request", format::escaped(request)) << " " << r_request.error();
|
||||||
return Status::OK();
|
return;
|
||||||
}();
|
}
|
||||||
|
|
||||||
LOG_IF(ERROR, status.is_error()) << "Failed to parse " << tag("request", format::escaped(request)) << " " << status;
|
client_.send(r_request.move_as_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
CSlice ClientJson::receive(double timeout) {
|
CSlice ClientJson::receive(double timeout) {
|
||||||
|
Loading…
Reference in New Issue
Block a user