multi: fix fmt.Errorf error wrapping
Refactor fmt.Errorf usage to correctly wrap errors instead of using non-wrapping format verbs.
This commit is contained in:
103 files changed
+426
-390
No files matched your search
+6
-3
@@ -287,7 +287,8 @@ func ParseLNAddressString(strAddress string, defaultPort string,
|
||||
// Finally, parse the address string using our generic address parser.
|
||||
addr, err := ParseAddressString(parsedAddr, defaultPort, tcpResolver)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid lightning address address: %v", err)
|
||||
return nil, fmt.Errorf("invalid lightning address address: %w",
|
||||
err)
|
||||
}
|
||||
|
||||
return &lnwire.NetAddress{
|
||||
@@ -316,7 +317,8 @@ func ParseLNAddressPubkey(strAddress string) (*btcec.PublicKey, string, error) {
|
||||
// Decode the hex pubkey to get the raw compressed pubkey bytes.
|
||||
pubKeyBytes, err := hex.DecodeString(parsedPubKey)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("invalid lightning address pubkey: %v", err)
|
||||
return nil, "", fmt.Errorf("invalid lightning address "+
|
||||
"pubkey: %w", err)
|
||||
}
|
||||
|
||||
// The compressed pubkey should have a length of exactly 33 bytes.
|
||||
@@ -329,7 +331,8 @@ func ParseLNAddressPubkey(strAddress string) (*btcec.PublicKey, string, error) {
|
||||
// key on the secp256k1 curve.
|
||||
pubKey, err := btcec.ParsePubKey(pubKeyBytes)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("invalid lightning address pubkey: %v", err)
|
||||
return nil, "", fmt.Errorf("invalid lightning address "+
|
||||
"pubkey: %w", err)
|
||||
}
|
||||
|
||||
return pubKey, parsedAddr, nil
|
||||
|
||||
+4
-4
@@ -263,7 +263,7 @@ func (db *DB) GetBackends(ctx context.Context, chanDBPath,
|
||||
db.Etcd.CloneWithSubNamespace(NSChannelDB),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error opening etcd DB: %v", err)
|
||||
return nil, fmt.Errorf("error opening etcd DB: %w", err)
|
||||
}
|
||||
closeFuncs[NSChannelDB] = etcdBackend.Close
|
||||
|
||||
@@ -545,7 +545,7 @@ func (db *DB) GetBackends(ctx context.Context, chanDBPath,
|
||||
AutoCompactMinAge: db.Bolt.AutoCompactMinAge,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error opening bolt DB: %v", err)
|
||||
return nil, fmt.Errorf("error opening bolt DB: %w", err)
|
||||
}
|
||||
closeFuncs[NSChannelDB] = boltBackend.Close
|
||||
|
||||
@@ -558,7 +558,7 @@ func (db *DB) GetBackends(ctx context.Context, chanDBPath,
|
||||
AutoCompactMinAge: db.Bolt.AutoCompactMinAge,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error opening macaroon DB: %v", err)
|
||||
return nil, fmt.Errorf("error opening macaroon DB: %w", err)
|
||||
}
|
||||
closeFuncs[NSMacaroonDB] = macaroonBackend.Close
|
||||
|
||||
@@ -571,7 +571,7 @@ func (db *DB) GetBackends(ctx context.Context, chanDBPath,
|
||||
AutoCompactMinAge: db.Bolt.AutoCompactMinAge,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error opening decayed log DB: %v", err)
|
||||
return nil, fmt.Errorf("error opening decayed log DB: %w", err)
|
||||
}
|
||||
closeFuncs[NSDecayedLogDB] = decayedLogBackend.Close
|
||||
|
||||
|
||||
Reference in new issue
Block a user