Wraps unpickleable exceptions.
Parameters: |
|
---|
The module of the original exception.
The name of the original exception class.
The arguments for the original exception.
Example
>>> try:
... something_raising_unpickleable_exc()
>>> except Exception, e:
... exc = UnpickleableException(e.__class__.__module__,
... e.__class__.__name__,
... e.args)
... pickle.dumps(exc) # Works fine.
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().