ExceptionGroup

Built-in ExceptionPython 2.0+Expert

Groups multiple exceptions together (3.11+); used with except*

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
# Triggering and catching ExceptionGroup
try:
    raise ExceptionGroup("example error")
except ExceptionGroup as e:
    print(f"Caught ExceptionGroup: {e}")
    print(f"Type: {type(e).__name__}")

ExceptionGroup is raised when groups multiple exceptions together (3.11+); used with except*. Always catch specific exceptions rather than bare except clauses.

Try in Playground

Tags

exceptionerror-handlingcore