Learning-Management-System/lms/accounts/validation_error.py
2025-01-18 11:15:01 +00:00

13 lines
No EOL
385 B
Python

from rest_framework.exceptions import APIException
class CustomValidationError(APIException):
status_code = 400
default_detail = 'A validation error occurred.'
default_code = 'validation_error'
def __init__(self, detail=None, code=None):
if detail is not None:
self.detail = detail
if code is not None:
self.status_code = code