Skip to content

Commit

Permalink
feat: improve return error on ValidateBasic()
Browse files Browse the repository at this point in the history
  • Loading branch information
vinhphuctadang committed Aug 22, 2023
1 parent e81ddc6 commit d6115f3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions x/authz/msgs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package authz

import (
"fmt"
"time"

"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
Expand Down Expand Up @@ -267,16 +268,16 @@ func (msg MsgExecCompat) ValidateBasic() error {
return sdkerrors.ErrInvalidRequest.Wrapf("messages cannot be empty")
}

for _, m := range msg.Msgs {
for idx, m := range msg.Msgs {
var iMsg sdk.Msg
err := codec.GlobalCdc.UnmarshalInterfaceJSON([]byte(m), &iMsg)
if err != nil {
return err
return fmt.Errorf("parse message at index %d error: %w", idx, err)
}

err = iMsg.ValidateBasic()
if err != nil {
return err
return fmt.Errorf("validate message at index %d error: %w", idx, err)
}
}

Expand Down

0 comments on commit d6115f3

Please sign in to comment.