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)

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

* Fix import

* Changelog
  • Loading branch information
ValarDragon authored Oct 1, 2022
1 parent b9773dc commit 1ec8658
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 @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Bug fixes

* [#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 1ec8658

Please sign in to comment.