Untitled
unknown
plain_text
10 months ago
459 B
3
Indexable
from rest_framework.exceptions import APIException class CustomSerializedException(APIException): def __init__(self, message, code): self.message = message self.code = code super().__init__(detail=message, code=code) try: raise CustomSerializedException("Custom message", "CUSTOM_CODE") except CustomSerializedException as e: print(f"Caught custom exception: {e.message}, Code: {e.code}")
Leave a Comment