async def validation_exception_handler(request: Request, exc: RequestValidationError): logger.debug(f"参数异常\n{request.method} | URL:{request.url}\n{exc}") return ORJSONResponse( status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, content=exc._error_cache, )
async def http_exception_handler(request: Request, exc: HTTPException): logger.debug( f"HTTP异常\n{request.method} | URL:{request.url} | {exc.detail}") return ORJSONResponse( status_code=status.HTTP_400_BAD_REQUEST, content=exc.detail, )
async def validation_exception_handler(request: Request, exc: RequestValidationError): logger.debug(f"参数异常\n{request.method} | URL:{request.url}\n{exc}") return response_code.resp_400(str(exc))
async def http_exception_handler(request: Request, exc: HTTPException): logger.debug( f"HTTP异常\n{request.method} | URL:{request.url} | {exc.detail}") return response_code.resp_400(exc.detail)
async def notfount_exception_handler(request: Request, exc: NotFoundException): logger.debug( f"无效请求\n{request.method} | URL:{request.url} | {exc.err_desc}") return response_code.resp_404(exc.err_desc)
async def token_exception_handler(request: Request, exc: UserTokenException): logger.debug( f"认证异常\n{request.method} | URL:{request.url} | {exc.err_desc}") return response_code.resp_403(exc.err_desc)