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

+5 -5
View File
@@ -49,8 +49,8 @@ impl McpTool for ReadStickyNotesHandler {
async fn execute(&self, _args: Value, state: Arc<MemoryState>) -> Result<String, String> {
let data = state
.sticky
.read_with(|s| serde_json::to_string(s).unwrap_or_else(|_| "[]".to_string()));
Ok(data.to_string())
.read_with(|s| serde_json::to_string(s).map_err(|e| e.to_string()))?;
Ok(data)
}
}
@@ -167,9 +167,9 @@ impl McpTool for ReadHandoffMemosHandler {
}
})
.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)
}
}