Skip to content

Commit

Permalink
Exception groups
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Oct 18, 2023
1 parent 5c707a9 commit a87e9e6
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docs/modern_python.md
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,46 @@ print(result)

---

### Vyhození skupiny výjimek

```python
eg = ExceptionGroup(
"one", [TypeError(1), ValueError(3), OSError(4)])

import traceback
traceback.print_exception(eg)
```

[Zdrojový kód příkladu](https://github.com/tisnik/most-popular-python-libs/blob/master/modern_python/sources//exception-group-1.py)

---

### Vyhození skupiny výjimek

```python
eg = ExceptionGroup(
"one",
[
TypeError(1),
ExceptionGroup(
"two",
[TypeError(2), ValueError(3)]
),
ExceptionGroup(
"three",
[OSError(4)]
)
]
)

import traceback
traceback.print_exception(eg)
```

[Zdrojový kód příkladu](https://github.com/tisnik/most-popular-python-libs/blob/master/modern_python/sources//exception-group-2.py)

---

## Deklarace datových typů

* Přidáváno postupně
Expand Down

0 comments on commit a87e9e6

Please sign in to comment.