我想为验证错误创建一个自定义处理程序。因此,我创建了自己的异常处理程序:
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request: Request, exc):
if "/couriers/" in request.url.path and request.method == "POST":
data = await request.json()
# Some logic
return JSONResponse(content={"some": "content"}, status_code=400)
但是,显然,出于某种原因,它只是挂在await
上。我可以很好地获得协同程序本身,但它从未被执行过(或者至少我想是这样)。为什么会这样
目前没有回答
相关问题 更多 >
编程相关推荐