Skip to content

Commit 49a9347

Browse files
committed
fix: prevent "Current ask promise was ignored" error from displaying to users
- Changed synchronous throw statements to Promise.reject() in Task.ask() method - This allows .catch() handlers in writeToFileTool to properly suppress expected errors - Fixes issue #6443 where users saw error messages during file writing after diff edits - All existing tests continue to pass
1 parent f3d2504 commit 49a9347

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/core/task/Task.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,14 +637,14 @@ export class Task extends EventEmitter<ClineEvents> {
637637
// saves, and only post parts of partial message instead of
638638
// whole array in new listener.
639639
this.updateClineMessage(lastMessage)
640-
throw new Error("Current ask promise was ignored (#1)")
640+
return Promise.reject(new Error("Current ask promise was ignored (#1)"))
641641
} else {
642642
// This is a new partial message, so add it with partial
643643
// state.
644644
askTs = Date.now()
645645
this.lastMessageTs = askTs
646646
await this.addToClineMessages({ ts: askTs, type: "ask", ask: type, text, partial, isProtected })
647-
throw new Error("Current ask promise was ignored (#2)")
647+
return Promise.reject(new Error("Current ask promise was ignored (#2)"))
648648
}
649649
} else {
650650
if (isUpdatingPreviousPartial) {
@@ -699,7 +699,7 @@ export class Task extends EventEmitter<ClineEvents> {
699699
// Could happen if we send multiple asks in a row i.e. with
700700
// command_output. It's important that when we know an ask could
701701
// fail, it is handled gracefully.
702-
throw new Error("Current ask promise was ignored")
702+
return Promise.reject(new Error("Current ask promise was ignored"))
703703
}
704704

705705
const result = { response: this.askResponse!, text: this.askResponseText, images: this.askResponseImages }

0 commit comments

Comments
 (0)