fix: replace bare except clauses with except Exception#15615
fix: replace bare except clauses with except Exception#15615haosenwang1018 wants to merge 1 commit intogoogleapis:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @haosenwang1018, 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 enhances the robustness and maintainability of several Google Cloud client libraries by standardizing exception handling. It specifically addresses the practice of using bare Highlights
Changelog
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.
Code Review
This pull request systematically replaces bare except: clauses with except Exception:. This is a valuable improvement to the codebase as it prevents catching system-exiting exceptions like SystemExit and KeyboardInterrupt, making the error handling more robust and predictable. The changes are applied consistently across a large number of files.
|
Hi @haosenwang1018, Thanks for opening a PR! Regrettably, the files in this PR are automatically generated using a code generator in https://github.com/googleapis/gapic-generator-python. If you're interested to submit a fix there, pull requests are welcome! The source of truth lives here: https://github.com/googleapis/gapic-generator-python/blob/535d65420751b5959f8e960ee532726da00159b6/gapic/templates/%25namespace/%25name_%25version/%25sub/services/%25service/transports/rest.py.j2#L275 Once the fix is merged in |
Replace bare except clauses with except Exception.