Skip to content

Commit

Permalink
Fix exception deserialization for unknown classes (celery#4835) (cele…
Browse files Browse the repository at this point in the history
  • Loading branch information
johnarnold authored and dfresh613 committed Jul 21, 2018
1 parent 3c7d01d commit 1df3bf1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion celery/backends/base.py
Expand Up @@ -21,6 +21,7 @@
from kombu.utils.encoding import bytes_to_str, ensure_bytes, from_utf8
from kombu.utils.url import maybe_sanitize_url

import celery.exceptions
from celery import current_app, group, maybe_signature, states
from celery._state import get_current_task
from celery.exceptions import (ChordError, ImproperlyConfigured,
Expand Down Expand Up @@ -249,7 +250,11 @@ def exception_to_python(self, exc):
else:
exc_module = from_utf8(exc_module)
exc_type = from_utf8(exc['exc_type'])
cls = getattr(sys.modules[exc_module], exc_type)
try:
cls = getattr(sys.modules[exc_module], exc_type)
except KeyError:
cls = create_exception_cls(exc_type,
celery.exceptions.__name__)
exc_msg = exc['exc_message']
exc = cls(*exc_msg if isinstance(exc_msg, tuple) else exc_msg)
if self.serializer in EXCEPTION_ABLE_CODECS:
Expand Down

0 comments on commit 1df3bf1

Please sign in to comment.