kwork-poizonstore/utils/exceptions.py
2024-05-20 23:09:49 +04:00

16 lines
389 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}
# TODO: exceptions with a same template: ok / error_code / error_message