fix: improve error probing in OpenAI and DeepSeek providers
This commit is contained in:
@@ -231,8 +231,12 @@ impl super::Provider for DeepSeekProvider {
|
||||
tracing::debug!("Offending DeepSeek Request Body: {}", serde_json::to_string(&probe_body).unwrap_or_default());
|
||||
Err(AppError::ProviderError(format!("DeepSeek API error ({}): {}", status, error_body)))?;
|
||||
}
|
||||
_ => {
|
||||
Err(AppError::ProviderError(format!("Stream error: {}", e)))?;
|
||||
Ok(_) => {
|
||||
Err(AppError::ProviderError(format!("Stream error (probe returned 200): {}", e)))?;
|
||||
}
|
||||
Err(probe_err) => {
|
||||
tracing::error!("DeepSeek Stream Error Probe failed: {}", probe_err);
|
||||
Err(AppError::ProviderError(format!("Stream error (probe failed: {}): {}", probe_err, e)))?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,8 +351,14 @@ impl super::Provider for OpenAIProvider {
|
||||
tracing::debug!("Offending OpenAI Request Body: {}", serde_json::to_string(&probe_body).unwrap_or_default());
|
||||
Err(AppError::ProviderError(format!("OpenAI API error ({}): {}", status, error_body)))?;
|
||||
}
|
||||
_ => {
|
||||
Err(AppError::ProviderError(format!("Stream error: {}", e)))?;
|
||||
Ok(_) => {
|
||||
// Probe returned success? This is unexpected if the original stream failed.
|
||||
Err(AppError::ProviderError(format!("Stream error (probe returned 200): {}", e)))?;
|
||||
}
|
||||
Err(probe_err) => {
|
||||
// Probe itself failed
|
||||
tracing::error!("OpenAI Stream Error Probe failed: {}", probe_err);
|
||||
Err(AppError::ProviderError(format!("Stream error (probe failed: {}): {}", probe_err, e)))?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user