Untitled
unknown
plain_text
2 years ago
459 B
8
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}")Editor is loading...
Leave a Comment