-
Notifications
You must be signed in to change notification settings - Fork 4k
refactor: use a more straightforward return value #23718
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -209,7 +209,7 @@ func (k Keeper) GetDelegatorUnbonding(ctx context.Context, delegator sdk.AccAddr | |||||
if err != nil { | ||||||
return unbonding, err | ||||||
} | ||||||
return unbonding, err | ||||||
return unbonding, nil | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restore error propagation. Suppressing the error from the Apply this diff to restore proper error handling: - return unbonding, nil
+ return unbonding, err 📝 Committable suggestion
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thats wrong rabbit. the error is handled above! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @technicallyty You're absolutely right, I apologize for the confusion. The error is properly handled in the check above, and returning ✏️ Learnings added
If you found this review helpful, would you consider giving us a shout-out on X? |
||||||
} | ||||||
|
||||||
// GetDelegatorBonded returns the total amount a delegator has bonded. | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
Reconsider error handling approach.
Suppressing the YAML marshaling error by returning
nil
could hide potential issues from callers. Consider propagating the original error to allow proper error handling upstream.Apply this diff to restore proper error handling:
📝 Committable suggestion
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.
check again, rabbit!
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.
@technicallyty You're right! I apologize for my previous comment. The current implementation is correct because:
yaml.Marshal
is already properly handled in theif err != nil
checknil
as the error is appropriate hereI'm retracting my previous suggestion. Thank you for the correction!
(`・ω・´)ゞ
✏️ Learnings added