Fix error swallowing by propagating JSON serialization errors to LLM
This commit is contained in:
1 parent
48a1973ea6
commit
01d3c22c57
6 files changed
+59
-59
No files matched your search
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user