From 7d6e04fbe80e007d33fad2ee6447cac6c3db3488 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Tue, 17 Dec 2024 00:25:26 -0500 Subject: [PATCH] Error formatting --- src/core/Cline.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 1426237..a4569d3 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1230,8 +1230,9 @@ export class Cline { if (!fileExists) { this.consecutiveMistakeCount++ - await this.say("error", `File does not exist at path: ${absolutePath}`) - pushToolResult(`Error: File does not exist at path: ${absolutePath}`) + const formattedError = `File does not exist at path: ${absolutePath}\n\n\nThe specified file could not be found. Please verify the file path and try again.\n` + await this.say("error", formattedError) + pushToolResult(formattedError) break } @@ -1251,11 +1252,12 @@ export class Cline { this.consecutiveMistakeCount++ const currentCount = (this.consecutiveMistakeCountForApplyDiff.get(relPath) || 0) + 1 this.consecutiveMistakeCountForApplyDiff.set(relPath, currentCount) - const errorDetails = diffResult.details ? `\n\nDetails:\n${JSON.stringify(diffResult.details, null, 2)}` : '' + const errorDetails = diffResult.details ? JSON.stringify(diffResult.details, null, 2) : '' + const formattedError = `Unable to apply diff to file: ${absolutePath}\n\n\n${diffResult.error}${errorDetails ? `\n\nDetails:\n${errorDetails}` : ''}\n` if (currentCount >= 2) { - await this.say("error", `Unable to apply diff to file: ${absolutePath}\n${diffResult.error}${errorDetails}`) + await this.say("error", formattedError) } - pushToolResult(`Error applying diff to file: ${absolutePath}\n${diffResult.error}${errorDetails}`) + pushToolResult(formattedError) break }