chore(all): replace all fmt.Errorf without paramters with errors.New (#21068)
This commit is contained in:
@@ -350,7 +350,7 @@ func New(l Logger, baseDir string, cfg Config) (NetworkI, error) {
|
||||
apiListenAddr = cfg.APIAddress
|
||||
} else {
|
||||
if len(portPool) == 0 {
|
||||
return nil, fmt.Errorf("failed to get port for API server")
|
||||
return nil, errors.New("failed to get port for API server")
|
||||
}
|
||||
port := <-portPool
|
||||
apiListenAddr = fmt.Sprintf("tcp://127.0.0.1:%s", port)
|
||||
@@ -367,7 +367,7 @@ func New(l Logger, baseDir string, cfg Config) (NetworkI, error) {
|
||||
cmtCfg.RPC.ListenAddress = cfg.RPCAddress
|
||||
} else {
|
||||
if len(portPool) == 0 {
|
||||
return nil, fmt.Errorf("failed to get port for RPC server")
|
||||
return nil, errors.New("failed to get port for RPC server")
|
||||
}
|
||||
port := <-portPool
|
||||
cmtCfg.RPC.ListenAddress = fmt.Sprintf("tcp://127.0.0.1:%s", port)
|
||||
@@ -377,7 +377,7 @@ func New(l Logger, baseDir string, cfg Config) (NetworkI, error) {
|
||||
appCfg.GRPC.Address = cfg.GRPCAddress
|
||||
} else {
|
||||
if len(portPool) == 0 {
|
||||
return nil, fmt.Errorf("failed to get port for GRPC server")
|
||||
return nil, errors.New("failed to get port for GRPC server")
|
||||
}
|
||||
port := <-portPool
|
||||
appCfg.GRPC.Address = fmt.Sprintf("127.0.0.1:%s", port)
|
||||
@@ -410,14 +410,14 @@ func New(l Logger, baseDir string, cfg Config) (NetworkI, error) {
|
||||
monikers[i] = nodeDirName
|
||||
|
||||
if len(portPool) == 0 {
|
||||
return nil, fmt.Errorf("failed to get port for Proxy server")
|
||||
return nil, errors.New("failed to get port for Proxy server")
|
||||
}
|
||||
port := <-portPool
|
||||
proxyAddr := fmt.Sprintf("tcp://127.0.0.1:%s", port)
|
||||
cmtCfg.ProxyApp = proxyAddr
|
||||
|
||||
if len(portPool) == 0 {
|
||||
return nil, fmt.Errorf("failed to get port for Proxy server")
|
||||
return nil, errors.New("failed to get port for Proxy server")
|
||||
}
|
||||
port = <-portPool
|
||||
p2pAddr := fmt.Sprintf("tcp://127.0.0.1:%s", port)
|
||||
|
||||
@@ -3,7 +3,7 @@ package sims
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
@@ -108,7 +108,7 @@ func TestAddr(addr, bech string) (sdk.AccAddress, error) {
|
||||
}
|
||||
bechexpected := res.String()
|
||||
if bech != bechexpected {
|
||||
return nil, fmt.Errorf("bech encoding doesn't match reference")
|
||||
return nil, errors.New("bech encoding doesn't match reference")
|
||||
}
|
||||
|
||||
bechres, err := sdk.AccAddressFromBech32(bech)
|
||||
|
||||
@@ -2,6 +2,7 @@ package sims
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -164,7 +165,7 @@ func SetupWithConfiguration(appConfig depinject.Config, startupConfig StartupCon
|
||||
// create validator set
|
||||
valSet, err := startupConfig.ValidatorSet()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create validator set")
|
||||
return nil, errors.New("failed to create validator set")
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -3,7 +3,7 @@ package sims
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"errors"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
@@ -289,7 +289,7 @@ func AppStateFromGenesisFileFn(r io.Reader, cdc codec.JSONCodec, genesisFile str
|
||||
|
||||
a, ok := acc.GetCachedValue().(sdk.AccountI)
|
||||
if !ok {
|
||||
return *genesis, nil, fmt.Errorf("expected account")
|
||||
return *genesis, nil, errors.New("expected account")
|
||||
}
|
||||
|
||||
// create simulator accounts
|
||||
|
||||
Vendored
+2
-1
@@ -2,6 +2,7 @@ package testdata
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -27,7 +28,7 @@ var _ QueryServer = QueryImpl{}
|
||||
func (e QueryImpl) TestAny(_ context.Context, request *TestAnyRequest) (*TestAnyResponse, error) {
|
||||
animal, ok := request.AnyAnimal.GetCachedValue().(test.Animal)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected Animal")
|
||||
return nil, errors.New("expected Animal")
|
||||
}
|
||||
|
||||
any, err := types.NewAnyWithValue(animal.(proto.Message))
|
||||
|
||||
Reference in New Issue
Block a user