multi: use the "errors" package everywhere

Replace all usages of the "github.com/go-errors/errors" and
"github.com/pkg/errors" packages with the standard lib's "errors"
package. This ensures that error wrapping and `errors.Is` checks will
work as expected.
This commit is contained in:
Elle Mouton
2025-06-30 08:46:50 +02:00
parent 5f961e4349
commit 8cf567b948
44 changed files with 114 additions and 109 deletions

View File

@@ -3,6 +3,7 @@ package lntest
import (
"context"
"fmt"
"runtime/debug"
"strings"
"testing"
"time"
@@ -13,7 +14,6 @@ import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/kvdb/etcd"
@@ -293,10 +293,22 @@ func (h *HarnessTest) Stop() {
// represented as fatal.
func (h *HarnessTest) RunTestCase(testCase *TestCase) {
defer func() {
if err := recover(); err != nil {
description := errors.Wrap(err, 2).ErrorStack()
h.Fatalf("Failed: (%v) panic with: \n%v",
testCase.Name, description)
if r := recover(); r != nil {
// Wrap the recovered panic in an error.
var err error
switch v := r.(type) {
case error:
err = v
default:
err = fmt.Errorf("%v", v)
}
// Capture and print the stack trace.
stack := debug.Stack()
// Fail the test with panic info and stack.
h.Fatalf("Failed: (%v) panic with: %v\n%s",
testCase.Name, err, stack)
}
}()