MCPcopy Create free account
hub / github.com/binkuolo/fastapi / unicorn_exception_handler

Function unicorn_exception_handler

core/Exception.py:108–119  ·  view source on GitHub ↗

unicorn 异常处理 :param _: :param exc: :return:

(_: Request, exc: UnicornException)

Source from the content-addressed store, hash-verified

106
107
108async def unicorn_exception_handler(_: Request, exc: UnicornException):
109 """
110 unicorn 异常处理
111 :param _:
112 :param exc:
113 :return:
114 """
115 return JSONResponse({
116 "code": exc.code,
117 "message": exc.errmsg,
118 "data": exc.data,
119 })
120
121
122async def http422_error_handler(_: Request, exc: Union[RequestValidationError, ValidationError],) -> JSONResponse:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected