From 9786bb7de68ee4636bf9d49aebbc527175af75f8 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 17:08:35 -0700 Subject: [PATCH] Stop returning error logs + stack trace when out of gas in ApplyFuncIfNoErr (backport #2914) (#2918) * Stop returning error logs + stack trace when out of gas in ApplyFuncIfNoErr (#2914) * Stop returning error logs + stack trace when theres an out of gas in ApplyFuncIfNoErr * Fix import * Changelog (cherry picked from commit 1ec86587e464e63cb3634e27b7b3ff42f11c6663) # Conflicts: # CHANGELOG.md * Fix merge conflict Co-authored-by: Dev Ojha Co-authored-by: mattverse --- osmoutils/cache_ctx.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osmoutils/cache_ctx.go b/osmoutils/cache_ctx.go index db93d188902..0802ddd8eec 100644 --- a/osmoutils/cache_ctx.go +++ b/osmoutils/cache_ctx.go @@ -6,6 +6,7 @@ import ( "runtime" "runtime/debug" + "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -38,6 +39,9 @@ func ApplyFuncIfNoError(ctx sdk.Context, f func(ctx sdk.Context) error) (err err func PrintPanicRecoveryError(ctx sdk.Context, recoveryError interface{}) { errStackTrace := string(debug.Stack()) switch e := recoveryError.(type) { + case types.ErrorOutOfGas: + ctx.Logger().Debug("out of gas error inside panic recovery block: " + e.Descriptor) + return case string: ctx.Logger().Error("Recovering from (string) panic: " + e) case runtime.Error: