Improve RPC client error messages
Reviewers: mtomic Reviewed By: mtomic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1268
This commit is contained in:
parent
f3da6a7bf3
commit
36eed4743a
@ -38,7 +38,7 @@ std::unique_ptr<Message> Client::Call(const Message &request) {
|
|||||||
socket_.emplace();
|
socket_.emplace();
|
||||||
buffer_.Clear();
|
buffer_.Clear();
|
||||||
if (!socket_->Connect(endpoint_)) {
|
if (!socket_->Connect(endpoint_)) {
|
||||||
LOG(ERROR) << "Couldn't connect to remote address: " << endpoint_;
|
LOG(ERROR) << "Couldn't connect to remote address " << endpoint_;
|
||||||
socket_ = std::experimental::nullopt;
|
socket_ = std::experimental::nullopt;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -65,13 +65,13 @@ std::unique_ptr<Message> Client::Call(const Message &request) {
|
|||||||
MessageSize request_data_size = request_buffer.size();
|
MessageSize request_data_size = request_buffer.size();
|
||||||
if (!socket_->Write(reinterpret_cast<uint8_t *>(&request_data_size),
|
if (!socket_->Write(reinterpret_cast<uint8_t *>(&request_data_size),
|
||||||
sizeof(MessageSize), true)) {
|
sizeof(MessageSize), true)) {
|
||||||
LOG(ERROR) << "Couldn't send request size!";
|
LOG(ERROR) << "Couldn't send request size to " << socket_->endpoint();
|
||||||
socket_ = std::experimental::nullopt;
|
socket_ = std::experimental::nullopt;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!socket_->Write(request_buffer)) {
|
if (!socket_->Write(request_buffer)) {
|
||||||
LOG(INFO) << "Couldn't send request data!";
|
LOG(ERROR) << "Couldn't send request data to " << socket_->endpoint();
|
||||||
socket_ = std::experimental::nullopt;
|
socket_ = std::experimental::nullopt;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -81,6 +81,7 @@ std::unique_ptr<Message> Client::Call(const Message &request) {
|
|||||||
auto buff = buffer_.Allocate();
|
auto buff = buffer_.Allocate();
|
||||||
auto received = socket_->Read(buff.data, buff.len);
|
auto received = socket_->Read(buff.data, buff.len);
|
||||||
if (received <= 0) {
|
if (received <= 0) {
|
||||||
|
LOG(ERROR) << "Couldn't get response from " << socket_->endpoint();
|
||||||
socket_ = std::experimental::nullopt;
|
socket_ = std::experimental::nullopt;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user