你正在阅读 Celery 3.1 的文档。开发版本文档见: 此处.
Utilities for safely pickling exceptions.
Wraps unpickleable exceptions.
参数: |
|
---|
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.
参数: | 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.
Get original exception from exception pickled using get_pickleable_exception().