File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
crates/ruff_linter/src/rules/flake8_blind_except/rules Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,25 @@ use crate::checkers::ast::Checker;
34
34
/// ...
35
35
/// ```
36
36
///
37
+ /// Exceptions that are re-raised will _not_ be flagged, as they're expected to
38
+ /// be caught elsewhere:
39
+ /// ```python
40
+ /// try:
41
+ /// foo()
42
+ /// except BaseException:
43
+ /// raise
44
+ /// ```
45
+ ///
46
+ /// Exceptions that are logged via `logging.exception()` or `logging.error()`
47
+ /// with `exc_info` enabled will _not_ be flagged, as this is a common pattern
48
+ /// for propagating exception traces:
49
+ /// ```python
50
+ /// try:
51
+ /// foo()
52
+ /// except BaseException:
53
+ /// logging.exception("Something went wrong")
54
+ /// ```
55
+ ///
37
56
/// ## References
38
57
/// - [Python documentation: The `try` statement](https://docs.python.org/3/reference/compound_stmts.html#the-try-statement)
39
58
/// - [Python documentation: Exception hierarchy](https://docs.python.org/3/library/exceptions.html#exception-hierarchy)
You can’t perform that action at this time.
0 commit comments