fix(kiosk): include response body in ONVIF SOAP error messages

HTTP 400 from camera gave no detail. Now includes first 500 chars
of response body in error message so Axiom shows the actual SOAP
fault reason.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mitchell R 2026-05-26 05:33:29 +02:00
parent c51d971819
commit 37cf03e37c
No known key found for this signature in database

View file

@ -256,7 +256,10 @@ fn soap_post(url: &str, action: &str, body: &str) -> Result<String, String> {
.send() .send()
.map_err(|e| format!("soap: {e}"))?; .map_err(|e| format!("soap: {e}"))?;
if !resp.status().is_success() { if !resp.status().is_success() {
return Err(format!("soap HTTP {}", resp.status())); let status = resp.status();
let body = resp.text().unwrap_or_default();
let preview: String = body.chars().take(500).collect();
return Err(format!("soap HTTP {status}: {preview}"));
} }
resp.text().map_err(|e| format!("soap body: {e}")) resp.text().map_err(|e| format!("soap body: {e}"))
} }