From 7d84372690763ccf9756a95046fb1863d8b56e48 Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Tue, 12 Dec 2023 20:19:17 +0900 Subject: [PATCH] directly emit wasm hook error --- app/ibc-middleware/util.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/ibc-middleware/util.go b/app/ibc-middleware/util.go index 507c817..04d3e96 100644 --- a/app/ibc-middleware/util.go +++ b/app/ibc-middleware/util.go @@ -87,19 +87,10 @@ func jsonStringHasKey(memo, key string) (found bool, jsonObject map[string]inter // newEmitErrorAcknowledgement creates a new error acknowledgement after having emitted an event with the // details of the error. -func newEmitErrorAcknowledgement(ctx sdk.Context, err error, errorContexts ...string) channeltypes.Acknowledgement { - attributes := make([]sdk.Attribute, len(errorContexts)+1) - attributes[0] = sdk.NewAttribute("error", err.Error()) - for i, s := range errorContexts { - attributes[i+1] = sdk.NewAttribute("error-context", s) +func newEmitErrorAcknowledgement(ctx sdk.Context, err error) channeltypes.Acknowledgement { + return channeltypes.Acknowledgement{ + Response: &channeltypes.Acknowledgement_Error{ + Error: fmt.Sprintf("ibc wasm hook error: %s", err.Error()), + }, } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - "ibc-acknowledgement-error", - attributes..., - ), - }) - - return channeltypes.NewErrorAcknowledgement(err) }