2025-04-29 15:43:53 +03:30
|
|
|
"""
|
|
|
|
|
You should probably add a custom exception handler to your project based on
|
|
|
|
|
who consumes your APIs. To learn how to create a custom exception handler,
|
|
|
|
|
you can check out the Django Rest Framework documentation at:
|
|
|
|
|
https://www.django-rest-framework.org/api-guide/exceptions/#custom-exception-handling
|
|
|
|
|
"""
|
2025-06-08 14:58:19 +03:30
|
|
|
|
|
|
|
|
from rest_framework.exceptions import APIException
|
|
|
|
|
from rest_framework import status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConflictException(APIException):
|
|
|
|
|
status_code = status.HTTP_409_CONFLICT
|
|
|
|
|
default_detail = "Object already exists."
|
|
|
|
|
default_code = "conflict"
|