fix: sanitize HTML error bodies from MCP servers to prevent web UI white screen (#263) (#656)

* fix: sanitize HTML error bodies from MCP servers to prevent web UI white screen (#263)

* style: fix cargo fmt formatting in sanitize_error_body tests
This commit is contained in:
Reid
2026-03-08 02:53:02 +00:00
committed by GitHub
parent 3b57d5bec9
commit a20e19ab16
3 changed files with 132 additions and 3 deletions
+2 -1
View File
@@ -200,9 +200,10 @@ impl SessionManager {
let status = response.status();
let body = response.text().await.unwrap_or_default();
let preview = crate::agent::truncate_for_preview(&body, 200);
Err(LlmError::SessionRenewalFailed {
provider: "nearai".to_string(),
reason: format!("Validation failed: HTTP {}: {}", status, body),
reason: format!("Validation failed: HTTP {status}: {preview}"),
})
}