Skip to content

Commit 0a82c3e

Browse files
authored
Merge pull request #4 from ignite/chore/remove-redundancy-error-pkg
chore: remove redudant error package
2 parents 49173f0 + 0645ce3 commit 0a82c3e

File tree

6 files changed

+12
-177
lines changed

6 files changed

+12
-177
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ all: tools install lint
7777
## govet: Run go vet.
7878
govet:
7979
@echo Running go vet...
80-
@go vet ./...
80+
@go vet $(shell go list ./... | grep -v '/api')
8181

8282
## govulncheck: Run govulncheck
8383
govulncheck:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ require (
4343
github.com/gorilla/mux v1.8.1
4444
github.com/grpc-ecosystem/grpc-gateway v1.16.0
4545
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0
46-
github.com/ignite/modules v0.0.3-0.20241105050027-482388061bf0
46+
github.com/ignite/modules v0.0.3-0.20241106034624-8a3f18117729
4747
github.com/pkg/errors v0.9.1
4848
github.com/spf13/cast v1.6.0
4949
github.com/spf13/cobra v1.8.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,8 +927,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
927927
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
928928
github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
929929
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
930-
github.com/ignite/modules v0.0.3-0.20241105050027-482388061bf0 h1:qvonR8WK2qH4Le87Y1qt6d6U2E4I09mCDE0BgCCfok4=
931-
github.com/ignite/modules v0.0.3-0.20241105050027-482388061bf0/go.mod h1:Rmv2KTn5jfXL/qkKdaHD4ExJ1eaH1iVQDs+YD4eTV+o=
930+
github.com/ignite/modules v0.0.3-0.20241106034624-8a3f18117729 h1:T3e1/0qilW8g8xIQYlhWdegT3txToTCcWNjnghrfma8=
931+
github.com/ignite/modules v0.0.3-0.20241106034624-8a3f18117729/go.mod h1:Rmv2KTn5jfXL/qkKdaHD4ExJ1eaH1iVQDs+YD4eTV+o=
932932
github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ=
933933
github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8=
934934
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=

pkg/errors/critical.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ package errors
33

44
import (
55
"fmt"
6+
7+
sdkerrors "cosmossdk.io/errors"
68
)
79

810
const codespace = "NETWORK-CRITICAL"
911

10-
var ErrCritical = Register(codespace, 3, "the state of the blockchain is inconsistent or an invariant is broken")
12+
var ErrCritical = sdkerrors.Register(codespace, 3, "the state of the blockchain is inconsistent or an invariant is broken")
1113

1214
// Critical handles and/or returns an error in case a critical error has been encountered:
1315
// - Inconsistent state
1416
// - Broken invariant
1517
func Critical(description string) error {
16-
return Wrap(ErrCritical, description)
18+
return sdkerrors.Wrap(ErrCritical, description)
1719
}
1820

1921
// Criticalf extends a critical error with additional information.

pkg/errors/errors.go

Lines changed: 0 additions & 166 deletions
This file was deleted.

x/profile/keeper/msg_server_validator.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
sdk "github.com/cosmos/cosmos-sdk/types"
99
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
1010

11-
"github.com/ignite/network/pkg/errors"
1211
"github.com/ignite/network/x/profile/types"
1312
)
1413

@@ -23,7 +22,7 @@ func (k msgServer) UpdateValidatorDescription(ctx context.Context, msg *types.Ms
2322

2423
// Check if the validator address is already in the store
2524
validator, err := k.Validator.Get(ctx, msg.Address)
26-
if errors.IsOf(err, collections.ErrNotFound) {
25+
if errorsmod.IsOf(err, collections.ErrNotFound) {
2726
validator = types.Validator{
2827
Address: msg.Address,
2928
Description: types.ValidatorDescription{},
@@ -48,7 +47,7 @@ func (k msgServer) UpdateValidatorDescription(ctx context.Context, msg *types.Ms
4847
validator.Description.SecurityContact = msg.SecurityContact
4948
}
5049

51-
if errors.IsOf(err, collections.ErrNotFound) {
50+
if errorsmod.IsOf(err, collections.ErrNotFound) {
5251
err = sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(
5352
&types.EventValidatorCreated{
5453
Address: validator.Address,
@@ -83,7 +82,7 @@ func (k msgServer) AddValidatorOperatorAddress(ctx context.Context, msg *types.M
8382

8483
// get the current validator to eventually overwrite description and add opAddr
8584
validatorStore, err := k.Validator.Get(ctx, valAddr)
86-
if !errors.IsOf(err, collections.ErrNotFound) {
85+
if !errorsmod.IsOf(err, collections.ErrNotFound) {
8786
validator.Description = validatorStore.Description
8887
validator = validatorStore.AddValidatorOperatorAddress(opAddr)
8988
}
@@ -100,7 +99,7 @@ func (k msgServer) AddValidatorOperatorAddress(ctx context.Context, msg *types.M
10099
}
101100

102101
sdkCtx := sdk.UnwrapSDKContext(ctx)
103-
if !errors.IsOf(err, collections.ErrNotFound) {
102+
if !errorsmod.IsOf(err, collections.ErrNotFound) {
104103
err = sdkCtx.EventManager().EmitTypedEvent(
105104
&types.EventValidatorOperatorAddressesUpdated{
106105
Address: validator.Address,

0 commit comments

Comments
 (0)