mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-02 10:21:16 +08:00
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:
@@ -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}"))
|
||||
})
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user