Skip to content

Commit

Permalink
add error context
Browse files Browse the repository at this point in the history
  • Loading branch information
sahith-narahari committed Apr 6, 2021
1 parent 7e8fc84 commit 76ae7fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions x/bank/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper

import (
"fmt"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -416,7 +417,7 @@ func (k BaseKeeper) setSupply(ctx sdk.Context, coin sdk.Coin) {

intBytes, err := coin.Amount.Marshal()
if err != nil {
panic("unexpected supply amount")
panic(fmt.Errorf("unable to marshal amount value %v", err))
}
supplyStore.Set([]byte(coin.GetDenom()), intBytes)
}
Expand Down Expand Up @@ -462,7 +463,7 @@ func (k BaseViewKeeper) IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bo
var amount sdk.Int
err := amount.Unmarshal(iterator.Value())
if err != nil {
panic("unexpected supply")
panic(fmt.Errorf("unable to unmarshal supply value %v", err))
}

balance := sdk.Coin{
Expand Down

0 comments on commit 76ae7fa

Please sign in to comment.