Skip to content

Commit

Permalink
cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Apr 3, 2024
1 parent b8601ba commit 623ec28
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions x/uibc/gmp/gmp_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,18 @@ func (h Handler) OnRecvPacket(ctx sdk.Context, coinReceived sdk.Coin, memoStr st
return Message{}, nil
}

logger := ctx.Logger().With("handler", "gmp_handler")
var msg Message
var err error

if err = json.Unmarshal([]byte(memoStr), &msg); err != nil {
logger.Error("cannot unmarshal memo", "err", err)
return Message{}, err
if err := json.Unmarshal([]byte(memoStr), &msg); err != nil {
return msg, err
}

switch msg.Type {
case TypeGeneralMessage:
return msg, fmt.Errorf("we are not supporting general message: %d", msg.Type)
return msg, fmt.Errorf("only msg.type=%d (TypeGeneralMessageWithToken) is supported",
TypeGeneralMessageWithToken)
case TypeGeneralMessageWithToken:
return msg, nil
default:
logger.Error("unrecognized gmp message type: %d", msg.Type)
return msg, fmt.Errorf("unrecognized gmp message type: %d", msg.Type)
}
}

0 comments on commit 623ec28

Please sign in to comment.