fix(proxy): replace unwrap/expect with graceful error handling

- Handle HTTP client initialization failure with no_proxy fallback
- Fix potential panic on Unicode slicing in API key preview
- Add proper error handling for response body builder
- Handle edge case where SystemTime is before UNIX_EPOCH
This commit is contained in:
Jason
2026-01-09 00:21:44 +08:00
parent d954df0c76
commit 37239f292c
4 changed files with 73 additions and 22 deletions
+4 -1
View File
@@ -291,7 +291,10 @@ async fn handle_claude_transform(
);
let body = axum::body::Body::from(response_body);
Ok(builder.body(body).unwrap())
builder.body(body).map_err(|e| {
log::error!("[Claude] 构建响应失败: {e}");
ProxyError::Internal(format!("Failed to build response: {e}"))
})
}
// ============================================================================