Skip to main content

create_exception_cls

Dynamically create an exception class.

def create_exception_cls(
name: string,
module: string,
parent: type = null
) - > type

Dynamically create an exception class.

Parameters​

NameTypeDescription
namestringThe name of the new exception class to be created
modulestringThe name of the module to which the new exception class will belong
parenttype = nullThe base exception class to inherit from; defaults to the built-in Exception class if not provided

Returns​

TypeDescription
typeA new exception class derived from the specified parent and associated with the given module