| 220 | } |
| 221 | |
| 222 | const handleError = async (action: string, error: Error) => { |
| 223 | // Silently ignore AskIgnoredError - this is an internal control flow |
| 224 | // signal, not an actual error. It occurs when a newer ask supersedes an older one. |
| 225 | if (error instanceof AskIgnoredError) { |
| 226 | return |
| 227 | } |
| 228 | const errorString = `Error ${action}: ${JSON.stringify(serializeError(error))}` |
| 229 | await cline.say( |
| 230 | "error", |
| 231 | `Error ${action}:\n${error.message ?? JSON.stringify(serializeError(error), null, 2)}`, |
| 232 | ) |
| 233 | pushToolResult(formatResponse.toolError(errorString)) |
| 234 | } |
| 235 | |
| 236 | if (!mcpBlock.partial) { |
| 237 | cline.recordToolUsage("use_mcp_tool") // Record as use_mcp_tool for analytics |