mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user