From 623ec282a4e46f929d193b7a874a4054fffd2f14 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 3 Apr 2024 13:16:00 +0200 Subject: [PATCH] cosmetic --- x/uibc/gmp/gmp_middleware.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/x/uibc/gmp/gmp_middleware.go b/x/uibc/gmp/gmp_middleware.go index c0e200835f..58ec8cc94f 100644 --- a/x/uibc/gmp/gmp_middleware.go +++ b/x/uibc/gmp/gmp_middleware.go @@ -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) } }