This document describes the current stable version of Celery (3.1). For development docs, go here.
Utilities for safely pickling exceptions.
Wraps unpickleable exceptions.
Parameters: |
|
---|
Example
>>> def pickle_it(raising_function):
... try:
... raising_function()
... except Exception as e:
... exc = UnpickleableExceptionWrapper(
... e.__class__.__module__,
... e.__class__.__name__,
... e.args,
... )
... pickle.dumps(exc) # Works fine.
The arguments for the original exception.
The name of the original exception class.
The module of the original exception.
With an exception instance, iterate over its super classes (by mro) and find the first super exception that is pickleable. It does not go below Exception (i.e. it skips Exception, BaseException and object). If that happens you should use UnpickleableException instead.
Parameters: | exc – An exception instance. |
---|
Will return the nearest pickleable parent exception class (except Exception and parents), or if the exception is pickleable it will return None.
:rtype Exception:
Dynamically create an exception class.
Make sure exception is pickleable.
Get original exception from exception pickled using get_pickleable_exception().