Skip to content

Commit

Permalink
unhandled errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Aug 1, 2024
1 parent 554ac0a commit 8a262fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions x/claim/keeper/airdrop_supply.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"context"

"cosmossdk.io/collections"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"

Expand Down Expand Up @@ -36,10 +37,10 @@ func (k Keeper) InitializeAirdropSupply(ctx context.Context, airdropSupply sdk.C

func (k Keeper) EndAirdrop(ctx context.Context) error {
airdropSupply, err := k.AirdropSupply.Get(ctx)
if err != nil {
if err != nil && !errors.IsOf(err, collections.ErrNotFound) {
return err
}
if !airdropSupply.Supply.IsPositive() {
if errors.IsOf(err, collections.ErrNotFound) || !airdropSupply.Supply.IsPositive() {
return nil
}

Expand All @@ -48,8 +49,8 @@ func (k Keeper) EndAirdrop(ctx context.Context) error {
return err
}

blockTime := sdk.UnwrapSDKContext(ctx).BlockTime()
decayInfo := params.DecayInformation
blockTime := sdk.UnwrapSDKContext(ctx).BlockTime()
if decayInfo.Enabled && blockTime.After(decayInfo.DecayEnd) {
err := k.distrKeeper.FundCommunityPool(
ctx,
Expand Down
8 changes: 8 additions & 0 deletions x/claim/simulation/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ func SimulateMsgClaim(
return value, nil
},
)
if err != nil {
return simtypes.NoOpMsg(
types.ModuleName,
msg.Type(),
fmt.Sprintf("chain has no missions: %s", err.Error()),
), nil, nil
}

for _, m := range missions {
if cr.IsMissionCompleted(m.MissionID) && !cr.IsMissionClaimed(m.MissionID) {
hasMission = true
Expand Down

0 comments on commit 8a262fc

Please sign in to comment.