mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-30 19:55:42 +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:
@@ -15,8 +15,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -411,7 +409,7 @@ func matchValue(value string, op Operator, operand reflect.Value) (bool, error)
|
||||
v, err = time.Parse(DateLayout, value)
|
||||
}
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, "failed to convert value %v from event attribute to time.Time", value)
|
||||
return false, fmt.Errorf("failed to convert value %v from event attribute to time.Time: %w", value, err)
|
||||
}
|
||||
|
||||
switch op {
|
||||
@@ -436,7 +434,7 @@ func matchValue(value string, op Operator, operand reflect.Value) (bool, error)
|
||||
// try our best to convert value from tags to float64
|
||||
v, err := strconv.ParseFloat(filteredValue, 64)
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, "failed to convert value %v from event attribute to float64", filteredValue)
|
||||
return false, fmt.Errorf("failed to convert value %v from event attribute to float64: %w", filteredValue, err)
|
||||
}
|
||||
|
||||
switch op {
|
||||
@@ -462,7 +460,7 @@ func matchValue(value string, op Operator, operand reflect.Value) (bool, error)
|
||||
if strings.ContainsAny(filteredValue, ".") {
|
||||
v1, err := strconv.ParseFloat(filteredValue, 64)
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, "failed to convert value %v from event attribute to float64", filteredValue)
|
||||
return false, fmt.Errorf("failed to convert value %v from event attribute to float64: %w", filteredValue, err)
|
||||
}
|
||||
|
||||
v = int64(v1)
|
||||
@@ -471,7 +469,7 @@ func matchValue(value string, op Operator, operand reflect.Value) (bool, error)
|
||||
// try our best to convert value from tags to int64
|
||||
v, err = strconv.ParseInt(filteredValue, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, "failed to convert value %v from event attribute to int64", filteredValue)
|
||||
return false, fmt.Errorf("failed to convert value %v from event attribute to int64: %w", filteredValue, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user