Skip to content

Commit

Permalink
fix: return errors from import assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
fastfadingviolets committed Dec 11, 2024
1 parent b523c25 commit 882b546
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x/distribution/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error

balances := k.bankKeeper.GetAllBalances(ctx, moduleAcc.GetAddress())
if balances.IsAllLT(moduleHoldingsInt) {
panic(fmt.Sprintf("distribution module balance is less than module holdings: %s < %s", balances, moduleHoldingsInt))
return fmt.Errorf("distribution module balance is less than module holdings: %s < %s", balances, moduleHoldingsInt)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion x/gov/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeepe

// check if the module account can cover the total deposits
if !balance.IsAllGTE(totalDeposits) {
panic(fmt.Sprintf("expected module to hold at least %s, but it holds %s", totalDeposits, balance))
return fmt.Errorf("expected module to hold at least %s, but it holds %s", totalDeposits, balance)
}
return nil
}
Expand Down

0 comments on commit 882b546

Please sign in to comment.