Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17f4d32

Browse files
committed
Client.Call(): do not return error if no Status is set (gRPC v1.23 and up)
To account for grpc/grpc-go@5da5b1f, which is part of gRPC v1.23.0 and up, and after which gRPC no longer sets a Status if no error occured. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent f969a7f commit 17f4d32

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ func (c *Client) Call(ctx context.Context, service, method string, req, resp int
134134
return err
135135
}
136136

137-
if cresp.Status == nil {
138-
return errors.New("no status provided on response")
137+
if cresp.Status != nil {
138+
return status.ErrorProto(cresp.Status)
139139
}
140140

141-
return status.ErrorProto(cresp.Status)
141+
return nil
142142
}
143143

144144
func (c *Client) dispatch(ctx context.Context, req *Request, resp *Response) error {

0 commit comments

Comments
 (0)