mirror of
https://github.com/stalwartlabs/stalwart.git
synced 2026-03-17 14:34:03 +00:00
AI API: Include request error details if available
This commit is contained in:
@@ -186,11 +186,15 @@ impl AiApiConfig {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let status = response.status();
|
||||
let bytes = response.bytes().await.unwrap_or_default();
|
||||
|
||||
Err(format!(
|
||||
"OpenAPI request to {} failed with code {}: {}",
|
||||
"OpenAPI request to {} failed with code {} ({}): {}",
|
||||
self.url,
|
||||
response.status().as_u16(),
|
||||
response.status().canonical_reason().unwrap_or("Unknown")
|
||||
status.as_u16(),
|
||||
status.canonical_reason().unwrap_or("Unknown"),
|
||||
std::str::from_utf8(&bytes).unwrap_or_default()
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user