kwork-poizonstore/store/exceptions.py
2023-07-03 06:38:55 +04:00

20 lines
499 B
Python

from rest_framework import status
from rest_framework.exceptions import APIException
class CRMException(APIException):
def __init__(self, detail=None):
if detail is None:
detail = self.default_detail
self.detail = {'error': detail}
class AuthErrorMixin(CRMException):
"""Authentication exception error mixin."""
status_code = status.HTTP_401_UNAUTHORIZED
class InvalidCredentialsException(AuthErrorMixin):
default_detail = 'cannot find the worker'