This commit is contained in:
wuaho 2021-06-03 09:31:14 +08:00
parent 5665a45c6d
commit 0538f2cacd

View File

@ -23,12 +23,12 @@ app.add_middleware(
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
return Response(schemas.Msg(code=-1, msg='服务器错误', data=str(exc)).json(), status_code=200)
return Response(schemas.Msg(code=-1, msg='请求错误', data=str(exc)).json(), status_code=400)
@app.exception_handler(Exception)
async def http_exception_handler(request, exc):
return Response(schemas.Msg(code=-1, msg='服务器错误', data=str(exc)).json(), status_code=200)
return Response(schemas.Msg(code=-1, msg='服务器错误', data=str(exc)).json(), status_code=500)
if __name__ == '__main__':