UnpickleableExceptionWrapper
Wraps unpickleable exceptions.
Attributes
| Attribute | Type | Description |
|---|---|---|
| exc_module | str = None | The module of the original exception. |
| exc_cls_name | str = None | The name of the original exception class. |
| exc_args | Tuple[Any, ...] = None | The arguments for the original exception. |
Constructor
Signature
def UnpickleableExceptionWrapper(
exc_module: str,
exc_cls_name: str,
exc_args: Tuple[Any, ...],
text: str = None
)
Parameters
| Name | Type | Description |
|---|---|---|
| exc_module | str | The module of the original exception. |
| exc_cls_name | str | The name of the original exception class. |
| exc_args | Tuple[Any, ...] | The arguments for the original exception. |
| text | str = None | The 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
| Type | Description |
|---|---|
Exception | An 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
| Name | Type | Description |
|---|---|---|
| exc | Exception | The original exception instance that needs to be wrapped for serialization. |
Returns
| Type | Description |
|---|---|
[UnpickleableExceptionWrapper](unpickleableexceptionwrapper.md?sid=celery_utils_serialization_unpickleableexceptionwrapper) | A serializable wrapper containing the metadata and traceback of the original exception. |