exception.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:ws-backend-community 作者: lavalamp- 项目源码 文件源码
def handle_validation_error(exc, context):
    """
    Handle the given ValidationError 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": "There was an error with the data that you submitted. Please check your input and try again.",
        "error_fields": exc.get_full_details(),
    }
    return response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号