exceptions.py 612 B

12345678910111213141516171819
  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 RQWorkerNotRunningException(APIException):
  9. """
  10. Indicates the temporary inability to enqueue a new task (e.g. custom script execution) because no RQ worker
  11. processes are currently running.
  12. """
  13. status_code = status.HTTP_503_SERVICE_UNAVAILABLE
  14. default_detail = 'Unable to process request: RQ worker process not running.'
  15. default_code = 'rq_worker_not_running'