chore: make fmt.Errorf use %w to wrap error instead of %v (#20350)

This commit is contained in:
Hoa Nguyen
2024-05-12 08:11:25 +00:00
committed by GitHub
parent 6853ba0468
commit 22aa95ccbd
20 changed files with 42 additions and 37 deletions
+2 -2
View File
@@ -170,7 +170,7 @@ func (k Keeper) withdrawRecipientFunds(ctx context.Context, recipientAddr string
withdrawnAmount := sdk.NewCoin(denom, fundsAllocated)
err = k.DistributeFromStreamFunds(ctx, sdk.NewCoins(withdrawnAmount), recipient)
if err != nil {
return sdk.Coin{}, fmt.Errorf("error while distributing funds to the recipient %s: %v", recipientAddr, err)
return sdk.Coin{}, fmt.Errorf("error while distributing funds to the recipient %s: %w", recipientAddr, err)
}
// reset fund distribution
@@ -220,7 +220,7 @@ func (k Keeper) SetToDistribute(ctx context.Context, amount sdk.Coins, addr stri
err = k.ToDistribute.Set(ctx, amount.AmountOf(denom))
if err != nil {
return fmt.Errorf("error while setting ToDistribute: %v", err)
return fmt.Errorf("error while setting ToDistribute: %w", err)
}
return nil
}
+1 -1
View File
@@ -194,7 +194,7 @@ func (k MsgServer) CancelContinuousFund(ctx context.Context, msg *types.MsgCance
// withdraw funds if any are allocated
withdrawnFunds, err := k.withdrawRecipientFunds(ctx, msg.RecipientAddress)
if err != nil && !errorspkg.Is(err, types.ErrNoRecipientFund) {
return nil, fmt.Errorf("error while withdrawing already allocated funds for recipient %s: %v", msg.RecipientAddress, err)
return nil, fmt.Errorf("error while withdrawing already allocated funds for recipient %s: %w", msg.RecipientAddress, err)
}
if err := k.ContinuousFund.Remove(ctx, recipient); err != nil {