fix: replace bare except with specific exception types#447
Open
leavesster wants to merge 1 commit intomainfrom
Open
fix: replace bare except with specific exception types#447leavesster wants to merge 1 commit intomainfrom
leavesster wants to merge 1 commit intomainfrom
Conversation
Bare except catches KeyboardInterrupt and SystemExit, preventing normal program termination. Now only catches KeyError, TypeError, ValueError which are the actual exceptions StoreKey.__init__ may raise.
Summary by CodeRabbitBug Fixes
✏️ Tip: You can customize this high-level summary in your review settings. 概览修改异常处理逻辑,将宽泛的 变更
代码审查工作量估算🎯 2 (Simple) | ⏱️ ~8 分钟 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a problematic bare except: clause by replacing it with specific exception types (KeyError, TypeError, ValueError). The bare except was catching all exceptions including KeyboardInterrupt and SystemExit, which prevented proper program termination.
Changes:
- Replaced bare
except:withexcept (KeyError, TypeError, ValueError):in thecreateContextfunction - Removed the
noqa: E722comment that was suppressing the linting warning
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
except:withexcept (KeyError, TypeError, ValueError):KeyboardInterruptandSystemExit, preventing normal program terminationStoreKey.__init__may actually raiseTest plan
KeyboardInterrupt(Ctrl+C) properly terminates the executor