-
Notifications
You must be signed in to change notification settings - Fork 2.2k
lnwallet: improve ErrBelowChanReserve error message for better UX #10471
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
base: master
Are you sure you want to change the base?
lnwallet: improve ErrBelowChanReserve error message for better UX #10471
Conversation
This commit updates the ErrBelowChanReserve error message to be more user-friendly and descriptive. The old message "commitment transaction dips peer below chan reserve" was technical and confusing for users. The new message clearly explains: - What happened: "cannot complete request: insufficient funds" - Why: "to maintain required channel reserve" - What channel reserve is: ensures both parties have incentive to behave honestly Fixes lightningnetwork#8957 Signed-off-by: majiayu000 <[email protected]>
Summary of ChangesHello @majiayu000, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the user experience by making a critical error message more informative. By clarifying the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request improves the user experience by providing a more descriptive error message for ErrBelowChanReserve. The new message clarifies why the operation failed and explains the purpose of channel reserves. While the change is good, the formatting of the multi-line string can be improved to better align with the repository's style guide.
lnwallet/channel.go
Outdated
| ErrBelowChanReserve = fmt.Errorf("cannot complete request: " + | ||
| "insufficient funds available to maintain required channel " + | ||
| "reserve (this reserve ensures both parties have skin in " + | ||
| "the game to discourage cheating)") |
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.
While the new error message is much more descriptive, the formatting can be made more compact to better align with the style guide's preference for minimizing lines in error messages. The current formatting uses four lines for the string concatenation, which could be reduced.
| ErrBelowChanReserve = fmt.Errorf("cannot complete request: " + | |
| "insufficient funds available to maintain required channel " + | |
| "reserve (this reserve ensures both parties have skin in " + | |
| "the game to discourage cheating)") | |
| ErrBelowChanReserve = fmt.Errorf("cannot complete request: " + | |
| "insufficient funds available to maintain required channel " + | |
| "reserve (this reserve ensures both parties have skin in the game " + | |
| "to discourage cheating)") |
References
- The style guide at lines 210-211 states that lines for log and error messages should be minimized. The current implementation uses four lines for the error string, which can be made more compact. (link)
|
@majiayu000, remember to re-request review from reviewers when ready |
Refactor the error message to use 2 lines instead of 4, following review feedback.
|
/gemini review |
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.
Code Review
This pull request improves the error message for ErrBelowChanReserve to provide a better user experience. The change is a good improvement. I've suggested making the new message more concise for better readability, while retaining all the useful information.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@Roasbeef I've updated the error message formatting as suggested. Ready for review! |
Fixes #8957
Changes
ErrBelowChanReserveerror message from the terse "commitment transaction dips peer below chan reserve" to a more user-friendly message that explains what went wrong and why channel reserves exist