Skip to main content

UnpickleableExceptionWrapper

Wraps unpickleable exceptions.

Attributes

AttributeTypeDescription
exc_modulestr = NoneThe module of the original exception.
exc_cls_namestr = NoneThe name of the original exception class.
exc_argsTuple[Any, ...] = NoneThe arguments for the original exception.

Constructor

Signature

def UnpickleableExceptionWrapper(
exc_module: str,
exc_cls_name: str,
exc_args: Tuple[Any, ...],
text: str = None
)

Parameters

NameTypeDescription
exc_modulestrThe module of the original exception.
exc_cls_namestrThe name of the original exception class.
exc_argsTuple[Any, ...]The arguments for the original exception.
textstr = NoneThe string representation of the exception.

Methods


restore()

@classmethod
def restore() - > Exception

Reconstructs the original exception instance by dynamically creating the exception class and initializing it with the stored arguments.

Returns

TypeDescription
ExceptionAn instance of the original exception type populated with the preserved arguments.

from_exception()

@classmethod
def from_exception(
exc: Exception
) - > [UnpickleableExceptionWrapper](unpickleableexceptionwrapper.md?sid=celery_utils_serialization_unpickleableexceptionwrapper)

Creates an UnpickleableExceptionWrapper from an existing exception instance, capturing its module, class name, arguments, and traceback.

Parameters

NameTypeDescription
excExceptionThe original exception instance that needs to be wrapped for serialization.

Returns

TypeDescription
[UnpickleableExceptionWrapper](unpickleableexceptionwrapper.md?sid=celery_utils_serialization_unpickleableexceptionwrapper)A serializable wrapper containing the metadata and traceback of the original exception.