Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(x/tx): Error handling now includes detailed information using fmt.Errorf #22796

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions x/tx/signing/textual/coins.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ func (vr coinsValueRenderer) Format(ctx context.Context, v protoreflect.Value) (
coin := &basev1beta1.Coin{}
err := coerceToMessage(v.Interface().(protoreflect.Message).Interface(), coin)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to coerce message to coin: %w", err)
}

metadata, err := vr.coinMetadataQuerier(ctx, coin.Denom)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to query coin metadata: %w", err)
}

formatted, err := FormatCoins([]*basev1beta1.Coin{coin}, []*bankv1beta1.Metadata{metadata})
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to format coins: %w", err)
}

return []Screen{{Content: formatted}}, nil
Expand All @@ -68,18 +68,18 @@ func (vr coinsValueRenderer) FormatRepeated(ctx context.Context, v protoreflect.
coin := &basev1beta1.Coin{}
err := coerceToMessage(protoCoins.Get(i).Interface().(protoreflect.Message).Interface(), coin)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to coerce message to coin: %w", err)
}
coins[i] = coin
metadatas[i], err = vr.coinMetadataQuerier(ctx, coin.Denom)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to query coin metadata: %w", err)
}
}

formatted, err := FormatCoins(coins, metadatas)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to format coins: %w", err)
}

return []Screen{{Content: formatted}}, nil
Expand Down
Loading