chore(all): replace all fmt.Errorf without paramters with errors.New (#21590)

This commit is contained in:
yukionfire
2024-09-09 06:50:03 +00:00
committed by GitHub
parent 644b263c71
commit 92f20f9794
3 changed files with 6 additions and 5 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
package postgres
import (
"errors"
"fmt"
"time"
@@ -18,7 +19,7 @@ func (tm *objectIndexer) bindKeyParams(key interface{}) ([]interface{}, []string
} else {
key, ok := key.([]interface{})
if !ok {
return nil, nil, fmt.Errorf("expected key to be a slice")
return nil, nil, errors.New("expected key to be a slice")
}
return tm.bindParams(tm.typ.KeyFields, key)
@@ -55,7 +56,7 @@ func (tm *objectIndexer) bindValueParams(value interface{}) (params []interface{
} else {
values, ok := value.([]interface{})
if !ok {
return nil, nil, fmt.Errorf("expected values to be a slice")
return nil, nil, errors.New("expected values to be a slice")
}
return tm.bindParams(tm.typ.ValueFields, values)
+1 -1
View File
@@ -33,7 +33,7 @@ func rpcClient(cmd *cobra.Command) (rpc.CometRPC, error) {
return nil, err
}
if rpcURI == "" {
return nil, fmt.Errorf("rpc URI is empty")
return nil, errors.New("rpc URI is empty")
}
return rpchttp.New(rpcURI)
+2 -2
View File
@@ -2,7 +2,7 @@ package keeper
import (
"context"
"fmt"
"errors"
"cosmossdk.io/x/bank/v2/types"
)
@@ -21,7 +21,7 @@ func NewQuerier(k *Keeper) types.QueryServer {
// Params implements types.QueryServer.
func (q querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
if req == nil {
return nil, fmt.Errorf("empty request")
return nil, errors.New("empty request")
}
params, err := q.params.Get(ctx)