-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add a better way to display errors to users, and implement initial cases (chooser, vcs backend) #10065
Conversation
@sourcery-ai review |
1 similar comment
@sourcery-ai review |
Reviewer's Guide by SourceryThis pull request introduces improved error handling and user experience for various scenarios, including checksum mismatches during package installation and errors during git operations. It leverages a new Sequence diagram for improved error handling flowsequenceDiagram
participant User
participant Poetry
participant Chooser
participant Git
participant Console
User->>Poetry: Run command
alt Package checksum mismatch
Poetry->>Chooser: Get package links
Chooser-->>Poetry: Raise PoetryRuntimeError
Poetry->>Console: Display formatted error<br/>with debug info
else Git operation fails
Poetry->>Git: Execute git command
Git-->>Poetry: Raise CalledProcessError
Poetry->>Console: Display formatted error<br/>with command details
end
Console-->>User: Show user-friendly error<br/>with debugging hints
Class diagram for new error handling classesclassDiagram
class PoetryConsoleError {
<<CleoError>>
}
class GroupNotFoundError {
<<PoetryConsoleError>>
}
class PoetryRuntimeError {
-messages: list[ConsoleMessage]
-exit_code: int
+write(io: IO)
+get_text(debug: bool, indent: str, strip: bool): str
+create(reason: str, exception: Exception, info: list[str]): PoetryRuntimeError
}
class ConsoleMessage {
+text: str
+debug: bool
+stripped: str
+wrap(tag: str): ConsoleMessage
+indent(indent: str): ConsoleMessage
+make_section(title: str, indent: str): ConsoleMessage
}
class PrettyCalledProcessError {
+message: ConsoleMessage
+output: ConsoleMessage
+errors: ConsoleMessage
+command_message: ConsoleMessage
+command: str
}
PoetryConsoleError <|-- GroupNotFoundError
PoetryConsoleError <|-- PoetryRuntimeError
PoetryRuntimeError --> ConsoleMessage
PrettyCalledProcessError --> ConsoleMessage
note for PoetryRuntimeError "New class for better error handling"
note for ConsoleMessage "Handles formatted console output"
note for PrettyCalledProcessError "Formats subprocess errors"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @abn - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
f30b118
to
b5283cb
Compare
@sourcery-ai 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.
Hey @abn - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This changes allows better error information propagation to facilitate improved ux for users encountering errors. Resolves: python-poetry#10057
This changes introduces the use of
PoetryRuntimeError
that allows better error information propagation.Also contained in this change are the following UX improvements.
Chooser
. (Resolves: Poetry cannot install Numpy 2.2.1 #10057)Chooser Error Improvements
Before
After
After (verbose)
Git Error Improvements
Before
After
After (verbose)
Summary by Sourcery
Improve the user experience when a package hash is not found during installation by providing more informative error messages.
Bug Fixes:
Enhancements:
Summary by Sourcery
Improve error handling and user experience for hash mismatch and various Git commands during package installation.
New Features:
PoetryRuntimeError
for better error propagation and formatting.Bug Fixes:
Enhancements: