This document describes an older version of Celery (2.5). For the latest stable version please go here.
Utilities for safely pickling exceptions.
copyright: |
|
---|---|
license: | BSD, see LICENSE for more details. |
Wraps unpickleable exceptions.
Parameters: |
|
---|
Example
>>> try:
... something_raising_unpickleable_exc()
>>> except Exception, e:
... exc = UnpickleableException(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.
Dynamically create an exception class.
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. |
---|---|
Returns: | the nearest exception if it’s not Exception or below, if it is it returns None. |
:rtype Exception:
Make sure exception is pickleable.
Get original exception from exception pickled using get_pickleable_exception().
List of base classes we probably don’t want to reduce to.