MCPcopy
hub / github.com/celery/celery / prepare_exception

Method prepare_exception

celery/backends/base.py:424–432  ·  view source on GitHub ↗

Prepare exception for serialization.

(self, exc, serializer=None)

Source from the content-addressed store, hash-verified

422 del tb
423
424 def prepare_exception(self, exc, serializer=None):
425 """Prepare exception for serialization."""
426 serializer = self.serializer if serializer is None else serializer
427 if serializer in EXCEPTION_ABLE_CODECS:
428 return get_pickleable_exception(exc)
429 exctype = type(exc)
430 return {'exc_type': getattr(exctype, '__qualname__', exctype.__name__),
431 'exc_message': ensure_serializable(exc.args, self.encode),
432 'exc_module': exctype.__module__}
433
434 def exception_to_python(self, exc):
435 """Convert serialized exception to Python exception."""

Callers 9

encode_resultMethod · 0.95
test_unpickleableMethod · 0.80
test_impossibleMethod · 0.80
test_regularMethod · 0.80
test_unicode_messageMethod · 0.80
report_internal_errorFunction · 0.80

Calls 2

get_pickleable_exceptionFunction · 0.90
ensure_serializableFunction · 0.90

Tested by 7

test_unpickleableMethod · 0.64
test_impossibleMethod · 0.64
test_regularMethod · 0.64
test_unicode_messageMethod · 0.64