-
Notifications
You must be signed in to change notification settings - Fork 261
Catch KeyError exceptions #1867
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
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR refactors exception handling in cli.py by adding KeyError to the primary catch, grouping similar exceptions into tuple-based except blocks, and removing redundant individual handlers for streamlined error processing. 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.
Summary of Changes
Hello @rhatdan, 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 refactors the exception handling within the eprint
function in ramalama/cli.py
. It consolidates several exception types that previously had separate except
blocks but shared similar error handling logic, specifically addressing a KeyError
issue found in containers/ramalama/issues/1864
by ensuring it's caught and handled consistently with other input-related errors.
Highlights
- Exception Consolidation: Grouped KeyError, ConnectionError, IndexError, and ValueError into a single except block, all now exiting with errno.EINVAL. This streamlines error handling for these related issues.
- Runtime Error Handling: Combined NotImplementedError and RuntimeError into a single except block, both now exiting with errno.ENOTSUP, improving consistency.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
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 refactors the exception handling in ramalama/cli.py
by grouping similar exception types, which improves code readability and maintainability. My review points out that this consolidation changes the exit code for KeyError
from 1
to errno.EINVAL
. This is a behavioral change that might have been overlooked and could impact users relying on the specific exit code. I've provided a suggestion to restore the original behavior if this change was unintentional.
Found in containers#1864 Also combine like exceptions, within the catch block. Signed-off-by: Daniel J Walsh <[email protected]>
@engelmi PTAL |
/packit retest-failed |
/packit rebuild-failed |
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.
LGTM
Found in #1864
Also combine like exceptions, within the catch block.
Summary by Sourcery
Unify exception handling in the CLI by grouping similar errors and including KeyError in the invalid input catch block
Bug Fixes:
Enhancements: