Skip to content

Commit

Permalink
fix: refactor usage of err.Error() (#1286)
Browse files Browse the repository at this point in the history
Co-authored-by: Apple <[email protected]>
  • Loading branch information
AshutoshKD and Apple authored Oct 9, 2024
1 parent 2717c18 commit 8d5fe8d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions x/rollapp/types/message_add_app.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package types

import (
errorsmod "cosmossdk.io/errors"
"errors"

sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion x/rollapp/types/message_remove_app.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package types

import (
"errors"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion x/rollapp/types/message_update_app.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package types

import (
"errors"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion x/rollapp/types/message_update_rollapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "*" {
Expand Down
2 changes: 1 addition & 1 deletion x/rollapp/types/rollapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d5fe8d

Please sign in to comment.