-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
STYLE: Prohibit parsing exeption messages in try/except code flows #62755
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: main
Are you sure you want to change the base?
Conversation
| errors.PyperclipException | ||
| errors.PyperclipWindowsException | ||
| errors.SpecificationError | ||
| errors.TimezoneDtypeMismatchError |
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.
@mroeschke is there a way to address the code smell of parsing error messages without making a ton of new public exceptions?
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.
I agree with @jbrockmendel that ideally we don't want to just define a new exception subclass to solve this issue.
For now, parsing an exception message to raise the same exception type with a new message seems OK (but not ideal). I think it would be more worthwhile to target areas where we parse the error message and perform a different behavior or raise a new error type. For this class of behavior, ideally we can restructure internal code to return True/False or iron out the tree of functions that call other functions that may raise Exceptions.
All that being said, this is issue is very non-trival
Got it. Let me see what I can do. |
Issue #50353
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.