multi: wrap all errors

This commit is contained in:
Oliver Gugger
2024-03-07 13:19:28 +01:00
committed by Andras Banki-Horvath
parent 9a28a4c105
commit 648fb22f63
60 changed files with 138 additions and 133 deletions

View File

@@ -70,7 +70,7 @@ func WriteElement(w io.Writer, element interface{}) error {
if e.PubKey != nil {
if err := binary.Write(w, byteOrder, true); err != nil {
return fmt.Errorf("error writing serialized element: %s", err)
return fmt.Errorf("error writing serialized element: %w", err)
}
return WriteElement(w, e.PubKey)

View File

@@ -1140,7 +1140,7 @@ func deserializeChanEdgePolicy(r io.Reader,
node, err := fetchLightningNode(nodes, pub[:])
if err != nil {
return nil, fmt.Errorf("unable to fetch node: %x, %v",
return nil, fmt.Errorf("unable to fetch node: %x, %w",
pub[:], err)
}
edge.Node = &node

View File

@@ -516,7 +516,7 @@ func MigratePruneEdgeUpdateIndex(tx kvdb.RwTx) error {
// well.
edgeIndex, err := edges.CreateBucketIfNotExists(edgeIndexBucket)
if err != nil {
return fmt.Errorf("error creating edge index bucket: %s", err)
return fmt.Errorf("error creating edge index bucket: %w", err)
}
if edgeIndex == nil {
return fmt.Errorf("unable to create/fetch edge index " +
@@ -546,7 +546,7 @@ func MigratePruneEdgeUpdateIndex(tx kvdb.RwTx) error {
return nil
})
if err != nil {
return fmt.Errorf("unable to gather existing edge policies: %v",
return fmt.Errorf("unable to gather existing edge policies: %w",
err)
}
@@ -560,7 +560,7 @@ func MigratePruneEdgeUpdateIndex(tx kvdb.RwTx) error {
return nil
})
if err != nil {
return fmt.Errorf("unable to gather existing edge updates: %v",
return fmt.Errorf("unable to gather existing edge updates: %w",
err)
}

View File

@@ -136,7 +136,7 @@ func encodeAmount(msat lnwire.MilliSatoshi) (string, error) {
// Should always be expressible in pico BTC.
pico, err := fromMSat['p'](msat)
if err != nil {
return "", fmt.Errorf("unable to express %d msat as pBTC: %v",
return "", fmt.Errorf("unable to express %d msat as pBTC: %w",
msat, err)
}
shortened := strconv.FormatUint(pico, 10) + "p"