kwork-poizonstore/store/exceptions.py
phzhik 859051a969 + statistics by clients
+ cdek_tracking
+ checklist create API
+ some permissions
* Cleanup
2023-07-05 02:19:58 +04:00

22 lines
546 B
Python

from rest_framework import status
from rest_framework.exceptions import APIException
class CRMException(APIException):
status_code = status.HTTP_400_BAD_REQUEST
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'