From a429c1cd7c122031eb2af055081706bd8bb20ea6 Mon Sep 17 00:00:00 2001 From: danqixu Date: Wed, 13 Mar 2024 17:06:39 -0400 Subject: [PATCH 1/2] Add error messages to return statements in BlockingDial function Signed-off-by: danqixu --- util/grpc/grpc.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/grpc/grpc.go b/util/grpc/grpc.go index 536da792e3048..1258f471f524d 100644 --- a/util/grpc/grpc.go +++ b/util/grpc/grpc.go @@ -3,6 +3,7 @@ package grpc import ( "context" "crypto/tls" + "fmt" "net" "runtime/debug" "strings" @@ -67,13 +68,13 @@ func BlockingDial(ctx context.Context, network, address string, creds credential conn, err := proxy.Dial(ctx, network, address) if err != nil { writeResult(err) - return nil, err + return nil, fmt.Errorf("error dial proxy: %s", err) } if creds != nil { conn, _, err = creds.ClientHandshake(ctx, address, conn) if err != nil { writeResult(err) - return nil, err + return nil, fmt.Errorf("error creating connection: %s", err) } } return conn, nil From 9b4d09a751856db9971f7a56ec2b64253ec5226b Mon Sep 17 00:00:00 2001 From: danqixu Date: Wed, 13 Mar 2024 22:37:40 -0400 Subject: [PATCH 2/2] amend error wrapping from %s to %w Signed-off-by: danqixu --- util/grpc/grpc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/grpc/grpc.go b/util/grpc/grpc.go index 1258f471f524d..a4f920e40252e 100644 --- a/util/grpc/grpc.go +++ b/util/grpc/grpc.go @@ -68,13 +68,13 @@ func BlockingDial(ctx context.Context, network, address string, creds credential conn, err := proxy.Dial(ctx, network, address) if err != nil { writeResult(err) - return nil, fmt.Errorf("error dial proxy: %s", err) + return nil, fmt.Errorf("error dial proxy: %w", err) } if creds != nil { conn, _, err = creds.ClientHandshake(ctx, address, conn) if err != nil { writeResult(err) - return nil, fmt.Errorf("error creating connection: %s", err) + return nil, fmt.Errorf("error creating connection: %w", err) } } return conn, nil