-
Notifications
You must be signed in to change notification settings - Fork 170
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
chore(auction): return error on Not Found auction ID #2544
Conversation
WalkthroughThe recent changes in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2544 +/- ##
===========================================
- Coverage 75.38% 62.76% -12.63%
===========================================
Files 100 275 +175
Lines 8025 15946 +7921
===========================================
+ Hits 6050 10009 +3959
- Misses 1589 5163 +3574
- Partials 386 774 +388
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- x/auction/keeper/grpc_query.go (2 hunks)
Additional comments not posted (1)
x/auction/keeper/grpc_query.go (1)
7-8
: Imports forgoogle.golang.org/grpc/codes
andgoogle.golang.org/grpc/status
added to support error handling.
k := q.Keeper(&ctx) | ||
rewards, id := k.getRewardsAuction(msg.Id) | ||
if rewards == nil { | ||
return nil, status.Error(codes.NotFound, "wrong ID") | ||
} | ||
r := &auction.QueryRewardsAuctionResponse{Id: id} | ||
r.Rewards = rewards.Rewards | ||
r.EndsAt = rewards.EndsAt | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling for a non-existent auction ID is correctly implemented. Consider improving the error message for clarity.
- return nil, status.Error(codes.NotFound, "wrong ID")
+ return nil, status.Error(codes.NotFound, "Auction ID not found")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
k := q.Keeper(&ctx) | |
rewards, id := k.getRewardsAuction(msg.Id) | |
if rewards == nil { | |
return nil, status.Error(codes.NotFound, "wrong ID") | |
} | |
r := &auction.QueryRewardsAuctionResponse{Id: id} | |
r.Rewards = rewards.Rewards | |
r.EndsAt = rewards.EndsAt | |
k := q.Keeper(&ctx) | |
rewards, id := k.getRewardsAuction(msg.Id) | |
if rewards == nil { | |
return nil, status.Error(codes.NotFound, "Auction ID not found") | |
} | |
r := &auction.QueryRewardsAuctionResponse{Id: id} | |
r.Rewards = rewards.Rewards | |
r.EndsAt = rewards.EndsAt |
Description
Summary by CodeRabbit