Skip to content

Commit b7b721c

Browse files
authoredMay 12, 2020
change use of errors.Wrap to fmt.Errorf with %w verb
Closes #4603 Commands used (VIM): ``` :args `rg -l errors.Wrap` :argdo normal @q | update ``` where q is a macros rewriting the `errors.Wrap` to `fmt.Errorf`.
1 parent 8d63d71 commit b7b721c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+321
-391
lines changed
 

‎blockchain/v0/reactor_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package v0
22

33
import (
4+
"fmt"
45
"os"
56
"sort"
67
"testing"
78
"time"
89

9-
"github.com/pkg/errors"
1010
"github.com/stretchr/testify/assert"
1111

1212
dbm "github.com/tendermint/tm-db"
@@ -64,7 +64,7 @@ func newBlockchainReactor(
6464
proxyApp := proxy.NewAppConns(cc)
6565
err := proxyApp.Start()
6666
if err != nil {
67-
panic(errors.Wrap(err, "error start app"))
67+
panic(fmt.Errorf("error start app: %w", err))
6868
}
6969

7070
blockDB := dbm.NewMemDB()
@@ -73,7 +73,7 @@ func newBlockchainReactor(
7373

7474
state, err := sm.LoadStateFromDBOrGenesisDoc(stateDB, genDoc)
7575
if err != nil {
76-
panic(errors.Wrap(err, "error constructing state from genesis file"))
76+
panic(fmt.Errorf("error constructing state from genesis file: %w", err))
7777
}
7878

7979
// Make the BlockchainReactor itself.
@@ -114,7 +114,7 @@ func newBlockchainReactor(
114114

115115
state, _, err = blockExec.ApplyBlock(state, blockID, thisBlock)
116116
if err != nil {
117-
panic(errors.Wrap(err, "error apply block"))
117+
panic(fmt.Errorf("error apply block: %w", err))
118118
}
119119

120120
blockStore.SaveBlock(thisBlock, thisParts, lastCommit)

‎blockchain/v1/reactor_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/pkg/errors"
1211
"github.com/stretchr/testify/assert"
1312
"github.com/stretchr/testify/require"
1413

@@ -94,7 +93,7 @@ func newBlockchainReactor(
9493
proxyApp := proxy.NewAppConns(cc)
9594
err := proxyApp.Start()
9695
if err != nil {
97-
panic(errors.Wrap(err, "error start app"))
96+
panic(fmt.Errorf("error start app: %w", err))
9897
}
9998

10099
blockDB := dbm.NewMemDB()
@@ -103,7 +102,7 @@ func newBlockchainReactor(
103102

104103
state, err := sm.LoadStateFromDBOrGenesisDoc(stateDB, genDoc)
105104
if err != nil {
106-
panic(errors.Wrap(err, "error constructing state from genesis file"))
105+
panic(fmt.Errorf("error constructing state from genesis file: %w", err))
107106
}
108107

109108
// Make the BlockchainReactor itself.
@@ -133,7 +132,7 @@ func newBlockchainReactor(
133132

134133
state, _, err = blockExec.ApplyBlock(state, blockID, thisBlock)
135134
if err != nil {
136-
panic(errors.Wrap(err, "error apply block"))
135+
panic(fmt.Errorf("error apply block: %w", err))
137136
}
138137

139138
blockStore.SaveBlock(thisBlock, thisParts, lastCommit)

0 commit comments

Comments
 (0)