def handle_non_field_error(exc, context):
"""
Handle the given WsRestNonFieldException and return a response.
: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.status_code = 400
response.data = {
"status_code": 400,
"message": "Invalid input received.",
"detail": exc.detail,
"error_fields": [],
}
return response
评论列表
文章目录