Skip to content

Commit

Permalink
Fix error processing in single node client
Browse files Browse the repository at this point in the history
  • Loading branch information
radekg committed Jan 14, 2022
1 parent 35033b8 commit 7f4f3f0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions client/single_node_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ func (c *defaultSingleNodeClient) readResponseInto(reader *bytes.Buffer, m proto
responseHeader := &ybApi.ResponseHeader{}
protoErr := utils.DeserializeProto(responseHeaderBuf, responseHeader)
if protoErr != nil {
opLogger.Error("failed unmarshalling response header", "reason", err)
opLogger.Error("failed unmarshalling response header", "reason", protoErr)
return &errors.ReceiveError{
Cause: fmt.Errorf("response header unprocessable: %s", err.Error()),
Cause: fmt.Errorf("response header unprocessable: %s", protoErr.Error()),
}
}

Expand Down Expand Up @@ -271,12 +271,13 @@ func (c *defaultSingleNodeClient) readResponseInto(reader *bytes.Buffer, m proto
for {
buf, err := c.recv()
if err != nil {
opLogger.Error("response payload read bytes count != expected count",
opLogger.Error("response payload read error",
"expected-payload-length", responsePayloadLength,
"read-payload-length", n)
"read-payload-length", n,
"reason", err)
return &errors.ReceiveError{
Cause: fmt.Errorf("response payload incomplete: read %d bytes vs expected %d",
n, responsePayloadLength),
Cause: fmt.Errorf("response payload read error: read %d bytes vs expected %d, reason: %s",
n, responsePayloadLength, err.Error()),
}
}

Expand Down

0 comments on commit 7f4f3f0

Please sign in to comment.