Built-in Exceptions

BaseExceptionGroup — exception class

Groups any nonempty collection of BaseException instances. If every contained item derives from Exception, direct construction selects ExceptionGroup automatically. If a control-flow signal is included, a broad except Exception handler will not catch the whole group. Use except* to select appropriate subgroups. The example raises a controlled stand-in to demonstrate handling; it does not cause the real system failure. Catch BaseExceptionGroup when this category is the recovery boundary; do not rely on the exact human-readable message.

Formal Syntax & Structure

python syntaxpython
BaseExceptionGroup

Return Value

type

The class object BaseExceptionGroup; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
try:    raise BaseExceptionGroup("batch", [KeyboardInterrupt(), ValueError()])except BaseExceptionGroup as error:    print(type(error).__name__)
Python Reference