Forbid `raise MyExc()` in except handler without `from`
See original GitHub issueRule request
Thesis
This is the follow-up to #1184 issue. R100 rule is not covered in WPS.
Reasoning
This example does not see to catch problems with from
absence:
try:
some_dct['bar']
except KeyError:
raise ValueError()
Also WPS329 doc cite such raise as example of correct code.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (13 by maintainers)
Top Results From Across the Web
Copy rules from flake8-raise · Issue #1184 - GitHub
It has three rule that I absolutely love to have in 0.15 : R100 raise in except handler without from; R101 use bare...
Read more >flake8-raise - PyPI
A flake8 plugin that finds that finds improvements for raise ... R100 raise in except handler without from. ... raise TypeError().
Read more >Exception Handling in REALbasic - Thomas Tempelmann
What's the purpose of Exception Handling? Raising Exceptions; Handling Exceptions; Creating your own Exception types; Adding more information to Exceptions you ...
Read more >Does raising an exception stop execution in Python? - Quora
Yes if the exception isn't captured by an except clause; and if it is captured then that exception is not re-raised or a...
Read more >Raising exceptions when an exception is already present in ...
Answering to question 3, you can use: raise B('second') from None. Which will remove the exception A traceback. Traceback (most recent call ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sometimes you don’t want to process an exception on the current layer but want to log it there. In this case, you’d use a bare
raise
Another case would be filtering out certain exception attributes. Like when an
OSError
happens, sometimes you want to only ignore one error code but you still want to pass-through other instances.Then it can be closed, thanks everyone!