fix: restore AppError::Internal for AST parser error, keeping BadRequest for JSON schema validation

This commit is contained in:
Riz Ashraf committed 2026-10-10 13:10:15 +01:00
1 parent 39528411f4
commit de060c4db4
10 files changed
+57 -57

No files matched your search

+2 -2
View File
@@ -22,7 +22,7 @@ impl McpTool for TasksHandler {
}
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
let req: TasksTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
let req: TasksTool = serde_json::from_value(args).map_err(|e| crate::error::AppError::BadRequest(format!("Schema validation failed. Your JSON arguments do not match the expected tool schema: {}", e)))?;
match req {
TasksTool::Add { title, description, parent_id, dependencies, git_branch, namespace, repo_name, priority, assigned_agent, verification_command } => {
let description = description.unwrap_or_default();
@@ -414,7 +414,7 @@ impl McpTool for MilestonesHandler {
}
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
let req: MilestonesTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
let req: MilestonesTool = serde_json::from_value(args).map_err(|e| crate::error::AppError::BadRequest(format!("Schema validation failed. Your JSON arguments do not match the expected tool schema: {}", e)))?;
match req {
MilestonesTool::Add { title, namespace, target_date, description, deliverables, task_ids, repo_name } => {
let ns = namespace.unwrap_or_else(crate::models::default_namespace);