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

This commit is contained in:
yukionfire
2024-07-25 14:54:49 +02:00
committed by GitHub
parent 6a2d039e12
commit d6ad92db0f
57 changed files with 127 additions and 103 deletions
+1 -2
View File
@@ -3,7 +3,6 @@ package query
import (
"context"
"errors"
"fmt"
"cosmossdk.io/collections"
collcodec "cosmossdk.io/collections/codec"
@@ -87,7 +86,7 @@ func CollectionFilteredPaginate[K, V any, C Collection[K, V], T any](
reverse := pageReq.Reverse
if offset > 0 && key != nil {
return nil, nil, fmt.Errorf("invalid request, either offset or key is expected, got both")
return nil, nil, errors.New("invalid request, either offset or key is expected, got both")
}
opt := new(CollectionsPaginateOptions[K])
+3 -3
View File
@@ -1,7 +1,7 @@
package query
import (
"fmt"
"errors"
"github.com/cosmos/gogoproto/proto"
@@ -26,7 +26,7 @@ func FilteredPaginate(
pageRequest = initPageRequestDefaults(pageRequest)
if pageRequest.Offset > 0 && pageRequest.Key != nil {
return nil, fmt.Errorf("invalid request, either offset or key is expected, got both")
return nil, errors.New("invalid request, either offset or key is expected, got both")
}
var (
@@ -151,7 +151,7 @@ func GenericFilteredPaginate[T, F proto.Message](
results := []F{}
if pageRequest.Offset > 0 && pageRequest.Key != nil {
return results, nil, fmt.Errorf("invalid request, either offset or key is expected, got both")
return results, nil, errors.New("invalid request, either offset or key is expected, got both")
}
var (
+2 -2
View File
@@ -1,7 +1,7 @@
package query
import (
"fmt"
"errors"
"math"
db "github.com/cosmos/cosmos-db"
@@ -62,7 +62,7 @@ func Paginate(
pageRequest = initPageRequestDefaults(pageRequest)
if pageRequest.Offset > 0 && pageRequest.Key != nil {
return nil, fmt.Errorf("invalid request, either offset or key is expected, got both")
return nil, errors.New("invalid request, either offset or key is expected, got both")
}
iterator := getIterator(prefixStore, pageRequest.Key, pageRequest.Reverse)