fix: restore AppError::Internal for AST parser error, keeping BadRequest for JSON schema validation
This commit is contained in:
1 parent
39528411f4
commit
de060c4db4
10 files changed
+57
-57
No files matched your search
@@ -28,7 +28,7 @@ impl McpTool for GetActiveWorktreeContextHandler {
|
||||
) -> crate::error::Result<String> {
|
||||
let result =
|
||||
tokio::task::spawn_blocking(move || -> crate::error::Result<serde_json::Value> {
|
||||
let cwd = env::current_dir().map_err(|e| e.to_string())?;
|
||||
let cwd = env::current_dir().map_err(|e| crate::error::AppError::Internal(format!("Failed to get current directory: {}", e)))?;
|
||||
let repo = git2::Repository::discover(&cwd).map_err(|e| {
|
||||
crate::error::AppError::Internal(format!("Not in a git repository: {}", e))
|
||||
})?;
|
||||
@@ -108,7 +108,7 @@ impl McpTool for QueryGitDiffsHandler {
|
||||
|
||||
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
|
||||
let req: crate::tools::QueryGitDiffsTool =
|
||||
serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
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)))?;
|
||||
let limit = req.limit.unwrap_or(5);
|
||||
let q = req.query.to_lowercase();
|
||||
|
||||
|
||||
Reference in new issue
Block a user