mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 20:31:37 -05:00
Better error handling when unable to apply diffs (#71)
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# Roo Cline Changelog
|
# Roo Cline Changelog
|
||||||
|
|
||||||
|
## [2.1.19]
|
||||||
|
|
||||||
|
- Better error handling for diff editing
|
||||||
|
|
||||||
## [2.1.18]
|
## [2.1.18]
|
||||||
|
|
||||||
- Diff editing bugfix to handle Windows line endings
|
- Diff editing bugfix to handle Windows line endings
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "roo-cline",
|
"name": "roo-cline",
|
||||||
"version": "2.1.18",
|
"version": "2.1.19",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "roo-cline",
|
"name": "roo-cline",
|
||||||
"version": "2.1.18",
|
"version": "2.1.19",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/bedrock-sdk": "^0.10.2",
|
"@anthropic-ai/bedrock-sdk": "^0.10.2",
|
||||||
"@anthropic-ai/sdk": "^0.26.0",
|
"@anthropic-ai/sdk": "^0.26.0",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"displayName": "Roo Cline",
|
"displayName": "Roo Cline",
|
||||||
"description": "A fork of Cline, an autonomous coding agent, with some added experimental configuration and automation features.",
|
"description": "A fork of Cline, an autonomous coding agent, with some added experimental configuration and automation features.",
|
||||||
"publisher": "RooVeterinaryInc",
|
"publisher": "RooVeterinaryInc",
|
||||||
"version": "2.1.18",
|
"version": "2.1.19",
|
||||||
"icon": "assets/icons/rocket.png",
|
"icon": "assets/icons/rocket.png",
|
||||||
"galleryBanner": {
|
"galleryBanner": {
|
||||||
"color": "#617A91",
|
"color": "#617A91",
|
||||||
|
|||||||
@@ -1208,12 +1208,12 @@ export class Cline {
|
|||||||
pushToolResult(await this.sayAndCreateMissingParamError("apply_diff", "diff"))
|
pushToolResult(await this.sayAndCreateMissingParamError("apply_diff", "diff"))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
this.consecutiveMistakeCount = 0
|
|
||||||
|
|
||||||
const absolutePath = path.resolve(cwd, relPath)
|
const absolutePath = path.resolve(cwd, relPath)
|
||||||
const fileExists = await fileExistsAtPath(absolutePath)
|
const fileExists = await fileExistsAtPath(absolutePath)
|
||||||
|
|
||||||
if (!fileExists) {
|
if (!fileExists) {
|
||||||
|
this.consecutiveMistakeCount++
|
||||||
await this.say("error", `File does not exist at path: ${absolutePath}`)
|
await this.say("error", `File does not exist at path: ${absolutePath}`)
|
||||||
pushToolResult(`Error: File does not exist at path: ${absolutePath}`)
|
pushToolResult(`Error: File does not exist at path: ${absolutePath}`)
|
||||||
break
|
break
|
||||||
@@ -1224,11 +1224,14 @@ export class Cline {
|
|||||||
// Apply the diff to the original content
|
// Apply the diff to the original content
|
||||||
let newContent = this.diffStrategy?.applyDiff(originalContent, diffContent) ?? false
|
let newContent = this.diffStrategy?.applyDiff(originalContent, diffContent) ?? false
|
||||||
if (newContent === false) {
|
if (newContent === false) {
|
||||||
await this.say("error", `Error applying diff to file: ${absolutePath}`)
|
this.consecutiveMistakeCount++
|
||||||
pushToolResult(`Error applying diff to file: ${absolutePath}`)
|
await this.say("error", `Unable to apply diff to file - contents are out of sync: ${absolutePath}`)
|
||||||
|
pushToolResult(`Error applying diff to file: ${absolutePath} - contents are out of sync. Try re-reading the relevant lines of the file and applying the diff again.`)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.consecutiveMistakeCount = 0
|
||||||
|
|
||||||
// Show diff view before asking for approval
|
// Show diff view before asking for approval
|
||||||
this.diffViewProvider.editType = "modify"
|
this.diffViewProvider.editType = "modify"
|
||||||
await this.diffViewProvider.open(relPath);
|
await this.diffViewProvider.open(relPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user