fastapi自定义异常 1、自定义异常类 import http import typing class MyException(Exception): def __init__( self, status_code: int, detail: typing.Optional[str] <