lnd: standardize printing to stdout

With this commit we standardize the error messages in the config parsing
section of the main package. We only print to stdout/stderr in a single
place and also make sure the same error is printed to the log (which
might or might not yet be initialized at that point).
This commit is contained in:
Oliver Gugger
2021-11-08 11:31:02 +01:00
parent 54584aabb6
commit 338afef862
4 changed files with 257 additions and 237 deletions

View File

@ -601,7 +601,7 @@ func (d *DefaultWalletImpl) BuildChainControl(
*walletConfig, partialChainControl.Cfg.BlockCache,
)
if err != nil {
fmt.Printf("unable to create wallet controller: %v\n", err)
err := fmt.Errorf("unable to create wallet controller: %v", err)
d.logger.Error(err)
return nil, nil, err
}
@ -676,7 +676,7 @@ func (d *RPCSignerWalletImpl) BuildChainControl(
*walletConfig, partialChainControl.Cfg.BlockCache,
)
if err != nil {
fmt.Printf("unable to create wallet controller: %v\n", err)
err := fmt.Errorf("unable to create wallet controller: %v", err)
d.logger.Error(err)
return nil, nil, err
}
@ -691,7 +691,8 @@ func (d *RPCSignerWalletImpl) BuildChainControl(
rpcwallet.DefaultRPCTimeout,
)
if err != nil {
fmt.Printf("unable to create RPC remote signing wallet %v", err)
err := fmt.Errorf("unable to create RPC remote signing wallet "+
"%v", err)
d.logger.Error(err)
return nil, nil, err
}