🐛 Bug: Fix the bug where httpx.RemoteProtocolError was not caught
Browse files
main.py
CHANGED
|
@@ -228,7 +228,7 @@ async def process_request(request: Union[RequestModel, ImageGenerationRequest],
|
|
| 228 |
app.middleware_stack.app.channel_success_counts[provider['provider']] += 1
|
| 229 |
|
| 230 |
return response
|
| 231 |
-
except (Exception, HTTPException, asyncio.CancelledError, httpx.ReadError) as e:
|
| 232 |
# 更新失败计数
|
| 233 |
async with app.middleware_stack.app.lock:
|
| 234 |
app.middleware_stack.app.channel_failure_counts[provider['provider']] += 1
|
|
@@ -388,7 +388,7 @@ class ModelRequestHandler:
|
|
| 388 |
continue
|
| 389 |
else:
|
| 390 |
raise HTTPException(status_code=500, detail=f"Error: Current provider response failed: {error_message}")
|
| 391 |
-
except (Exception, asyncio.CancelledError, httpx.ReadError) as e:
|
| 392 |
logger.error(f"Error with provider {provider['provider']}: {str(e)}")
|
| 393 |
error_message = str(e)
|
| 394 |
if auto_retry:
|
|
|
|
| 228 |
app.middleware_stack.app.channel_success_counts[provider['provider']] += 1
|
| 229 |
|
| 230 |
return response
|
| 231 |
+
except (Exception, HTTPException, asyncio.CancelledError, httpx.ReadError, httpx.RemoteProtocolError) as e:
|
| 232 |
# 更新失败计数
|
| 233 |
async with app.middleware_stack.app.lock:
|
| 234 |
app.middleware_stack.app.channel_failure_counts[provider['provider']] += 1
|
|
|
|
| 388 |
continue
|
| 389 |
else:
|
| 390 |
raise HTTPException(status_code=500, detail=f"Error: Current provider response failed: {error_message}")
|
| 391 |
+
except (Exception, asyncio.CancelledError, httpx.ReadError, httpx.RemoteProtocolError) as e:
|
| 392 |
logger.error(f"Error with provider {provider['provider']}: {str(e)}")
|
| 393 |
error_message = str(e)
|
| 394 |
if auto_retry:
|