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 (#2914) (#2919)

* Stop returning error logs + stack trace when
theres an out of gas in ApplyFuncIfNoErr

* Fix import

* Changelog

(cherry picked from commit 1ec8658)

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
  • Loading branch information
mergify[bot] and ValarDragon authored Oct 1, 2022
1 parent 06c9c84 commit 286c389
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* [#2739](https://github.com/osmosis-labs/osmosis/pull/2739) Add pool type query
* [#2803](https://github.com/osmosis-labs/osmosis/pull/2803) Fix total pool liquidity CLI query.
* [#2914](https://github.com/osmosis-labs/osmosis/pull/2914) Remove out of gas panics from node logs

### Misc Improvements

Expand Down
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 @@ -40,6 +41,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 286c389

Please sign in to comment.