Skip to content

Commit

Permalink
Exception group example #2
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Oct 19, 2023
1 parent 6be7394 commit ea5e03a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions modern_python/sources/exception-group-2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
eg = ExceptionGroup(
"one",
[
TypeError(1),
ExceptionGroup(
"two",
[TypeError(2), ValueError(3)]
),
ExceptionGroup(
"three",
[OSError(4)]
)
]
)

import traceback
traceback.print_exception(eg)

0 comments on commit ea5e03a

Please sign in to comment.