Skip to content

Commit 882b546

Browse files
fix: return errors from import assertions
1 parent b523c25 commit 882b546

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

x/distribution/keeper/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error
124124

125125
balances := k.bankKeeper.GetAllBalances(ctx, moduleAcc.GetAddress())
126126
if balances.IsAllLT(moduleHoldingsInt) {
127-
panic(fmt.Sprintf("distribution module balance is less than module holdings: %s < %s", balances, moduleHoldingsInt))
127+
return fmt.Errorf("distribution module balance is less than module holdings: %s < %s", balances, moduleHoldingsInt)
128128
}
129129
return nil
130130
}

x/gov/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeepe
8181

8282
// check if the module account can cover the total deposits
8383
if !balance.IsAllGTE(totalDeposits) {
84-
panic(fmt.Sprintf("expected module to hold at least %s, but it holds %s", totalDeposits, balance))
84+
return fmt.Errorf("expected module to hold at least %s, but it holds %s", totalDeposits, balance)
8585
}
8686
return nil
8787
}

0 commit comments

Comments
 (0)