Skip to content

Commit 3880c50

Browse files
sososonia-cyberAtlas Botamyreese
authored
docs: Fix misleading description for B904 rule (#23731)
Co-authored-by: Atlas Bot <atlas@clawdbot.local> Co-authored-by: Amethyst Reese <amethyst@n7.gg>
1 parent 29cce18 commit 3880c50

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

crates/ruff_linter/src/rules/flake8_bugbear/rules/raise_without_from_inside_except.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ use crate::checkers::ast::Checker;
1818
/// printing the stack trace, chained exceptions are displayed in such a way
1919
/// so as make it easier to trace the exception back to its root cause.
2020
///
21-
/// When raising an exception from within an `except` clause, always include a
22-
/// `from` clause to facilitate exception chaining. If the exception is not
23-
/// chained, it will be difficult to trace the exception back to its root cause.
21+
/// When raising a new exception from within an `except` clause, it's recommended to
22+
/// include a `from` clause to explicitly set the exception's cause. Without it,
23+
/// Python will implicitly chain from the current exception (setting `__context__`),
24+
/// but the `__cause__` attribute won't be set, which may make debugging slightly
25+
/// more difficult.
2426
///
2527
/// ## Example
2628
/// ```python

0 commit comments

Comments
 (0)