Fix error swallowing by propagating JSON serialization errors to LLM

This commit is contained in:
Riz Ashraf committed 2026-09-27 09:44:04 +01:00
1 parent 48a1973ea6
commit 01d3c22c57
6 files changed
+59 -59

No files matched your search

+4 -4
View File
@@ -62,7 +62,7 @@ impl McpTool for ReadEnvFingerprintHandler {
.read_with(|fps| fps.get(&req.namespace).cloned());
if let Some(fp) = data {
let data = serde_json::to_string(&fp).unwrap_or_default();
Ok(data.to_string())
Ok(data)
} else {
Ok("{}".to_string())
}
@@ -155,9 +155,9 @@ impl McpTool for GetEnvironmentDetailsHandler {
.iter()
.filter(|e| e.namespace == req.namespace)
.collect();
serde_json::to_string(&filtered).unwrap_or_default()
});
Ok(data.to_string())
serde_json::to_string(&filtered).map_err(|e| e.to_string())
})?;
Ok(data)
}
}