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

This commit is contained in:
yukionfire 2024-09-09 14:50:03 +08:00 committed by GitHub
parent 644b263c71
commit 92f20f9794
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

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)

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)

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)