unicorn 异常处理 :param _: :param exc: :return:
(_: Request, exc: UnicornException)
| 76 | |
| 77 | |
| 78 | async 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 | |
| 92 | async def http422_error_handler(_: Request, exc: Union[RequestValidationError, ValidationError],) -> JSONResponse: |
nothing calls this directly
no outgoing calls
no test coverage detected