diff --git a/client.go b/client.go index 26c3dd2a9..887b31a5d 100644 --- a/client.go +++ b/client.go @@ -19,6 +19,7 @@ package ttrpc import ( "context" "errors" + "fmt" "io" "net" "os" @@ -105,7 +106,7 @@ type callRequest struct { func (c *Client) Call(ctx context.Context, service, method string, req, resp interface{}) error { payload, err := c.codec.Marshal(req) if err != nil { - return err + return fmt.Errorf("marshal error: %v", err) } var ( @@ -130,11 +131,11 @@ func (c *Client) Call(ctx context.Context, service, method string, req, resp int FullMethod: fullPath(service, method), } if err := c.interceptor(ctx, creq, cresp, info, c.dispatch); err != nil { - return err + return fmt.Errorf("interceptor error: %v", err) } if err := c.codec.Unmarshal(cresp.Payload, resp); err != nil { - return err + return fmt.Errorf("unmarshal error: %v", err) } if cresp.Status != nil && cresp.Status.Code != int32(codes.OK) {