exceptions.py 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """
  2. Common Exceptions
  3. """
  4. UNREGISTERED_FMT = """
  5. Task of kind %s is not registered, please make sure it's imported.
  6. """.strip()
  7. class ImproperlyConfigured(Exception):
  8. """Celery is somehow improperly configured."""
  9. class NotRegistered(KeyError):
  10. """The task is not registered."""
  11. def __init__(self, message, *args, **kwargs):
  12. message = UNREGISTERED_FMT % str(message)
  13. KeyError.__init__(self, message, *args, **kwargs)
  14. class AlreadyRegistered(Exception):
  15. """The task is already registered."""
  16. pass
  17. class TimeoutError(Exception):
  18. """The operation timed out."""
  19. class MaxRetriesExceededError(Exception):
  20. """The tasks max restart limit has been exceeded."""
  21. class RetryTaskError(Exception):
  22. """The task is to be retried later."""
  23. def __init__(self, message, exc, *args, **kwargs):
  24. self.exc = exc
  25. Exception.__init__(self, message, exc, *args, **kwargs)