mirror of
https://github.com/status-im/consul.git
synced 2025-01-24 12:40:17 +00:00
Merge pull request #9149 from joel0/wrap-errors
Use error wrapping to preserve error type info
This commit is contained in:
commit
3760e3d12d
@ -519,7 +519,7 @@ START:
|
|||||||
// Try to get a conn first
|
// Try to get a conn first
|
||||||
conn, err := p.acquire(dc, nodeName, addr)
|
conn, err := p.acquire(dc, nodeName, addr)
|
||||||
if err != nil {
|
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
|
// Get a client
|
||||||
@ -533,7 +533,7 @@ START:
|
|||||||
retries++
|
retries++
|
||||||
goto START
|
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
|
return conn, client, nil
|
||||||
}
|
}
|
||||||
@ -575,14 +575,14 @@ func (p *ConnPool) rpcInsecure(dc string, addr net.Addr, method string, args int
|
|||||||
var codec rpc.ClientCodec
|
var codec rpc.ClientCodec
|
||||||
conn, _, err := p.dial(dc, addr, 0, RPCTLSInsecure)
|
conn, _, err := p.dial(dc, addr, 0, RPCTLSInsecure)
|
||||||
if err != nil {
|
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)
|
codec = msgpackrpc.NewCodecFromHandle(true, true, conn, structs.MsgpackHandle)
|
||||||
|
|
||||||
// Make the RPC call
|
// Make the RPC call
|
||||||
err = msgpackrpc.CallWithCodec(codec, method, args, reply)
|
err = msgpackrpc.CallWithCodec(codec, method, args, reply)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("rpcinsecure error making call: %v", err)
|
return fmt.Errorf("rpcinsecure error making call: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user