refactor: simply errors (#15067)

This commit is contained in:
Julien Robert
2023-02-20 12:03:40 +00:00
committed by GitHub
parent f69b9ff58f
commit 067ee92d4d
51 changed files with 391 additions and 160 deletions
+1 -2
View File
@@ -7,8 +7,7 @@ import (
cmttypes "github.com/cometbft/cometbft/types"
"github.com/spf13/cobra"
"github.com/pkg/errors"
"cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
+1 -2
View File
@@ -9,11 +9,10 @@ import (
"os"
"path/filepath"
"cosmossdk.io/errors"
cmttypes "github.com/cometbft/cometbft/types"
"github.com/spf13/cobra"
"github.com/pkg/errors"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
+5 -4
View File
@@ -3,16 +3,17 @@ package cli
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"os"
"path/filepath"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math/unsafe"
cfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/libs/cli"
"github.com/cometbft/cometbft/types"
"github.com/cosmos/go-bip39"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
@@ -130,7 +131,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
appState, err := json.MarshalIndent(appGenState, "", " ")
if err != nil {
return errors.Wrap(err, "Failed to marshal default genesis state")
return errorsmod.Wrap(err, "Failed to marshal default genesis state")
}
genDoc := &types.GenesisDoc{}
@@ -141,7 +142,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
} else {
genDoc, err = types.GenesisDocFromFile(genFile)
if err != nil {
return errors.Wrap(err, "Failed to read genesis doc from file")
return errorsmod.Wrap(err, "Failed to read genesis doc from file")
}
}
@@ -150,7 +151,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
genDoc.AppState = appState
if err = genutil.ExportGenesisFile(genDoc, genFile); err != nil {
return errors.Wrap(err, "Failed to export genesis file")
return errorsmod.Wrap(err, "Failed to export genesis file")
}
toPrint := newPrintInfo(config.Moniker, chainID, nodeID, "", appState)
+1 -1
View File
@@ -6,8 +6,8 @@ import (
"sort"
"time"
"cosmossdk.io/errors"
cmtjson "github.com/cometbft/cometbft/libs/json"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"