From 1925e2441e117612f6e937446c35fd95bf4ac285 Mon Sep 17 00:00:00 2001 From: Doug Fawley Date: Wed, 30 Jan 2019 16:28:11 -0800 Subject: [PATCH] client: don't allow io.EOF to be passed from balancer to user (#2604) --- picker_wrapper.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/picker_wrapper.go b/picker_wrapper.go index 672c14b1500b..a2575c9637b0 100644 --- a/picker_wrapper.go +++ b/picker_wrapper.go @@ -141,9 +141,16 @@ func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer. continue } return nil, nil, status.Errorf(codes.Unavailable, "%v, latest connection error: %v", err, bp.connectionError()) + case context.DeadlineExceeded: + return nil, nil, status.Error(codes.DeadlineExceeded, err.Error()) + case context.Canceled: + return nil, nil, status.Error(codes.Canceled, err.Error()) default: + if _, ok := status.FromError(err); ok { + return nil, nil, err + } // err is some other error. - return nil, nil, toRPCErr(err) + return nil, nil, status.Error(codes.Unknown, err.Error()) } }