Skip to content

Commit

Permalink
chore(all): replace all fmt.Errorf without paramters with errors.New
Browse files Browse the repository at this point in the history
  • Loading branch information
yukionfire committed Sep 9, 2024
1 parent 95383f5 commit e01855b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions indexer/postgres/params.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package postgres

import (
"errors"
"fmt"
"time"

Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion server/v2/cometbft/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions x/bank/v2/keeper/query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package keeper

import (
"context"
"fmt"
"errors"

"cosmossdk.io/x/bank/v2/types"
)
Expand All @@ -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)
Expand Down

0 comments on commit e01855b

Please sign in to comment.