Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/data/messages/t/try-except-raise/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
1 / 0
except ZeroDivisionError as e: # [try-except-raise]
raise
Comment thread
matusvalo marked this conversation as resolved.
8 changes: 8 additions & 0 deletions doc/data/messages/t/try-except-raise/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The try except might be remove entirely:
Comment thread
Pierre-Sassoulas marked this conversation as resolved.
Outdated
1 / 0

# Or another more detailed exception can be raised:
try:
1 / 0
except ZeroDivisionError as e:
raise ValueError("The area of the rectangle cannot be zero") from e
โšก