我是非常新的python和fastapi.
@app.exception_handler(Exception)
async def exception_callback(request: Request, exc: Exception):
logger.error(exc.detail)
但上述方法从未执行过.
class MyException(Exception):
#some code
@app.exception_handler(MyException)
async def exception_callback(request: Request, exc: MyException):
logger.error(exc.detail)
我经历了Catch exception type of Exception and process body request #575次.但是这个bug谈到了访问请求体.看到这个虫子后,我觉得应该可以捕捉Exception
.
提前感谢:)