> Every page of the ganymede website is listed in https://eugo.io/docs/ganymede/llms.txt.

# ExceptionGroup

> A backport of the BaseExceptionGroup and ExceptionGroup classes from Python 3.11. Use python 3.11+ type syntax in previous Python versions.

Web page: https://eugo.io/docs/ganymede/demo_notebooks/utilities/exceptiongroup/
Notebook: https://eugo.io/docs/ganymede/demo_notebooks/utilities/exceptiongroup/exceptiongroup.ipynb (source: https://github.com/eugo-inc/ganymede/blob/main/demo_notebooks/utilities/exceptiongroup.ipynb)

Description:
- A backport of the BaseExceptionGroup and ExceptionGroup classes from Python 3.11. Use python 3.11+ type syntax in previous Python versions.

Resources:
- [GitHub] https://github.com/agronholm/exceptiongroup
- [GitHub Example Tests] https://github.com/agronholm/exceptiongroup/blob/main/tests/test_catch.py

## Example 1

Backport of python 3.11+ exception handling

```python
from exceptiongroup import ExceptionGroup, catch

def value_key_err_handler(excgroup: ExceptionGroup) -> None:
    for exc in excgroup.exceptions:
        print('Caught exception:', type(exc))

def runtime_err_handler(exc: ExceptionGroup) -> None:
    print('Caught runtime error')

with catch({
    (ValueError, KeyError): value_key_err_handler,
    RuntimeError: runtime_err_handler
}):
    example_dct = {"hi": "eugo"}

    # Generate a key error
    res = example_dct["not_a_key"]
```
