register_tortoise(
add_exception_handlers=False)
@app.exception_handler(BaseORMException)
async def business_exception_handler(request: Request, error: BaseORMException):
return JSONResponse(
status_code=status.HTTP_200_OK,
content={
"code": status.HTTP_500_INTERNAL_SERVER_ERROR,
"message": "服务器错误"
}
)