Skip to content

Commit 0c52ef0

Browse files
committed
fix: show notification when corrupt task fails to load
- Added error handling in showTaskWithId to catch when getTaskWithId fails - Added new i18n error message "task_corrupt_deleted" to explain the issue - Added comprehensive unit tests for the showTaskWithId method - Refreshes webview state after showing the error notification Fixes #6592
1 parent a921d05 commit 0c52ef0

File tree

3 files changed

+511
-2
lines changed

3 files changed

+511
-2
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,8 +1343,16 @@ export class ClineProvider
13431343
async showTaskWithId(id: string) {
13441344
if (id !== this.getCurrentCline()?.taskId) {
13451345
// Non-current task.
1346-
const { historyItem } = await this.getTaskWithId(id)
1347-
await this.initClineWithHistoryItem(historyItem) // Clears existing task.
1346+
try {
1347+
const { historyItem } = await this.getTaskWithId(id)
1348+
await this.initClineWithHistoryItem(historyItem) // Clears existing task.
1349+
} catch (error) {
1350+
// Task not found or corrupt - it has already been deleted from state by getTaskWithId
1351+
vscode.window.showErrorMessage(t("common:errors.task_corrupt_deleted"))
1352+
// Refresh the webview to update the task list
1353+
await this.postStateToWebview()
1354+
return
1355+
}
13481356
}
13491357

13501358
await this.postMessageToWebview({ type: "action", action: "chatButtonClicked" })

0 commit comments

Comments
 (0)