Skip to content

Commit

Permalink
Stop returning error logs + stack trace when out of gas in ApplyFuncI…
Browse files Browse the repository at this point in the history
…fNoErr (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 1ec8658)

# Conflicts:
#	CHANGELOG.md

* Fix merge conflict

Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: mattverse <[email protected]>
  • Loading branch information
3 people authored Oct 13, 2022
1 parent eb31c7a commit 9786bb7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions osmoutils/cache_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"runtime"
"runtime/debug"

"github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 9786bb7

Please sign in to comment.