From 8d5fe8d0e06ec4bbaa41f4a152f543ce20ac5815 Mon Sep 17 00:00:00 2001 From: Ashutosh Dubey Date: Wed, 9 Oct 2024 18:29:15 +0530 Subject: [PATCH] fix: refactor usage of err.Error() (#1286) Co-authored-by: Apple --- x/rollapp/types/message_add_app.go | 5 +++-- x/rollapp/types/message_remove_app.go | 4 +++- x/rollapp/types/message_update_app.go | 4 +++- x/rollapp/types/message_update_rollapp.go | 2 +- x/rollapp/types/rollapp.go | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/x/rollapp/types/message_add_app.go b/x/rollapp/types/message_add_app.go index 2d05a8342..3d4620904 100644 --- a/x/rollapp/types/message_add_app.go +++ b/x/rollapp/types/message_add_app.go @@ -1,7 +1,8 @@ package types import ( - errorsmod "cosmossdk.io/errors" + "errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -57,7 +58,7 @@ func (msg *MsgAddApp) GetApp() App { func (msg *MsgAddApp) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return errorsmod.Wrap(ErrInvalidCreatorAddress, err.Error()) + return errors.Join(ErrInvalidCreatorAddress, err) } app := msg.GetApp() diff --git a/x/rollapp/types/message_remove_app.go b/x/rollapp/types/message_remove_app.go index 1d9bc8207..4a51968c2 100644 --- a/x/rollapp/types/message_remove_app.go +++ b/x/rollapp/types/message_remove_app.go @@ -1,6 +1,8 @@ package types import ( + "errors" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -53,7 +55,7 @@ func (msg *MsgRemoveApp) GetApp() App { func (msg *MsgRemoveApp) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return errorsmod.Wrap(ErrInvalidCreatorAddress, err.Error()) + return errors.Join(ErrInvalidCreatorAddress, err) } if msg.Id == 0 { diff --git a/x/rollapp/types/message_update_app.go b/x/rollapp/types/message_update_app.go index a98d36bbe..0198919fc 100644 --- a/x/rollapp/types/message_update_app.go +++ b/x/rollapp/types/message_update_app.go @@ -1,6 +1,8 @@ package types import ( + "errors" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -58,7 +60,7 @@ func (msg *MsgUpdateApp) GetApp() App { func (msg *MsgUpdateApp) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return errorsmod.Wrap(ErrInvalidCreatorAddress, err.Error()) + return errors.Join(ErrInvalidCreatorAddress, err) } if msg.Id == 0 { diff --git a/x/rollapp/types/message_update_rollapp.go b/x/rollapp/types/message_update_rollapp.go index ff7a3ded1..d0dabc19f 100644 --- a/x/rollapp/types/message_update_rollapp.go +++ b/x/rollapp/types/message_update_rollapp.go @@ -53,7 +53,7 @@ func (msg *MsgUpdateRollappInformation) GetSignBytes() []byte { func (msg *MsgUpdateRollappInformation) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Owner) if err != nil { - return errorsmod.Wrap(ErrInvalidCreatorAddress, err.Error()) + return errors.Join(ErrInvalidCreatorAddress, err) } if msg.InitialSequencer != "" && msg.InitialSequencer != "*" { diff --git a/x/rollapp/types/rollapp.go b/x/rollapp/types/rollapp.go index 7cf366e0c..05a1ec20e 100644 --- a/x/rollapp/types/rollapp.go +++ b/x/rollapp/types/rollapp.go @@ -56,7 +56,7 @@ func (r Rollapp) LastStateUpdateHeightIsSet() bool { func (r Rollapp) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(r.Owner) if err != nil { - return errorsmod.Wrap(ErrInvalidCreatorAddress, err.Error()) + return errors.Join(ErrInvalidCreatorAddress, err) } // validate rollappId