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`.
This commit is contained in:
Anton Kaliaev
2020-05-12 07:35:47 +04:00
committed by GitHub
parent 8d63d7192f
commit b7b721c484
90 changed files with 321 additions and 391 deletions

View File

@@ -9,8 +9,6 @@ import (
"strings"
"time"
"github.com/pkg/errors"
dbm "github.com/tendermint/tm-db"
"github.com/tendermint/tendermint/libs/pubsub/query"
@@ -186,18 +184,18 @@ func (txi *TxIndex) Search(ctx context.Context, q *query.Query) ([]*types.TxResu
// get a list of conditions (like "tx.height > 5")
conditions, err := q.Conditions()
if err != nil {
return nil, errors.Wrap(err, "error during parsing conditions from query")
return nil, fmt.Errorf("error during parsing conditions from query: %w", err)
}
// if there is a hash condition, return the result immediately
hash, ok, err := lookForHash(conditions)
if err != nil {
return nil, errors.Wrap(err, "error during searching for a hash in the query")
return nil, fmt.Errorf("error during searching for a hash in the query: %w", err)
} else if ok {
res, err := txi.Get(hash)
switch {
case err != nil:
return []*types.TxResult{}, errors.Wrap(err, "error while retrieving the result")
return []*types.TxResult{}, fmt.Errorf("error while retrieving the result: %w", err)
case res == nil:
return []*types.TxResult{}, nil
default:
@@ -258,7 +256,7 @@ func (txi *TxIndex) Search(ctx context.Context, q *query.Query) ([]*types.TxResu
for _, h := range filteredHashes {
res, err := txi.Get(h)
if err != nil {
return nil, errors.Wrapf(err, "failed to get Tx{%X}", h)
return nil, fmt.Errorf("failed to get Tx{%X}: %w", h, err)
}
results = append(results, res)