From 52f8ada38eef6a16f5496126e9286a407e69925b Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 10 Nov 2020 18:27:08 -0500 Subject: [PATCH] Merge pull request #9149 from joel0/wrap-errors Use error wrapping to preserve error type info --- agent/pool/pool.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agent/pool/pool.go b/agent/pool/pool.go index 1d5452e646..c4924f1752 100644 --- a/agent/pool/pool.go +++ b/agent/pool/pool.go @@ -526,7 +526,7 @@ START: // Try to get a conn first conn, err := p.acquire(dc, nodeName, addr) if err != nil { - return nil, nil, fmt.Errorf("failed to get conn: %v", err) + return nil, nil, fmt.Errorf("failed to get conn: %w", err) } // Get a client @@ -540,7 +540,7 @@ START: retries++ goto START } - return nil, nil, fmt.Errorf("failed to start stream: %v", err) + return nil, nil, fmt.Errorf("failed to start stream: %w", err) } return conn, client, nil } @@ -582,14 +582,14 @@ func (p *ConnPool) rpcInsecure(dc string, nodeName string, addr net.Addr, method var codec rpc.ClientCodec conn, _, err := p.dial(dc, nodeName, addr, 0, RPCTLSInsecure) if err != nil { - return fmt.Errorf("rpcinsecure error establishing connection: %v", err) + return fmt.Errorf("rpcinsecure error establishing connection: %w", err) } codec = msgpackrpc.NewCodecFromHandle(true, true, conn, structs.MsgpackHandle) // Make the RPC call err = msgpackrpc.CallWithCodec(codec, method, args, reply) if err != nil { - return fmt.Errorf("rpcinsecure error making call: %v", err) + return fmt.Errorf("rpcinsecure error making call: %w", err) } return nil