def handle_api_exception(exc, context):
"""
Handle the given APIException.
:param exc: The exception that was thrown.
:param context: The context in which the exception was thrown.
:return: A Django Response object.
"""
response = exception_handler(exc, context)
response.data = {
"status_code": response.status_code,
"message": "Exception thrown",
"detail": exc.detail,
"error_fields": [],
}
return response
评论列表
文章目录