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

Function unicorn_exception_handler

core/Exception.py:78–89  ·  view source on GitHub ↗

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

(_: Request, exc: UnicornException)

Source from the content-addressed store, hash-verified

76
77
78async def unicorn_exception_handler(_: Request, exc: UnicornException):
79 """
80 unicorn 异常处理
81 :param _:
82 :param exc:
83 :return:
84 """
85 return JSONResponse({
86 "code": exc.code,
87 "message": exc.errmsg,
88 "data": exc.data,
89 })
90
91
92async 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