diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index edbde32ea7..a014d0c826 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -637,14 +637,14 @@ export class Task extends EventEmitter { // saves, and only post parts of partial message instead of // whole array in new listener. this.updateClineMessage(lastMessage) - throw new Error("Current ask promise was ignored (#1)") + return Promise.reject(new Error("Current ask promise was ignored (#1)")) } else { // This is a new partial message, so add it with partial // state. askTs = Date.now() this.lastMessageTs = askTs await this.addToClineMessages({ ts: askTs, type: "ask", ask: type, text, partial, isProtected }) - throw new Error("Current ask promise was ignored (#2)") + return Promise.reject(new Error("Current ask promise was ignored (#2)")) } } else { if (isUpdatingPreviousPartial) { @@ -699,7 +699,7 @@ export class Task extends EventEmitter { // Could happen if we send multiple asks in a row i.e. with // command_output. It's important that when we know an ask could // fail, it is handled gracefully. - throw new Error("Current ask promise was ignored") + return Promise.reject(new Error("Current ask promise was ignored")) } const result = { response: this.askResponse!, text: this.askResponseText, images: this.askResponseImages }