exceptions.py 775 B

123456789101112131415161718192021222324252627
  1. from rest_framework import status
  2. from rest_framework.exceptions import APIException
  3. class AbortTransaction(Exception):
  4. """
  5. A dummy exception used to trigger a database transaction rollback.
  6. """
  7. pass
  8. class PermissionsViolation(Exception):
  9. """
  10. Raised when an operation was prevented because it would violate the
  11. allowed permissions.
  12. """
  13. pass
  14. class RQWorkerNotRunningException(APIException):
  15. """
  16. Indicates the temporary inability to enqueue a new task (e.g. custom script execution) because no RQ worker
  17. processes are currently running.
  18. """
  19. status_code = status.HTTP_503_SERVICE_UNAVAILABLE
  20. default_detail = 'Unable to process request: RQ worker process not running.'
  21. default_code = 'rq_worker_not_running'