File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 99import { updateToReplaceSteps } from "../../../prosemirror/changeset.js" ;
1010import { RebaseTool } from "../../../prosemirror/rebaseTool.js" ;
1111import { Result , streamTool } from "../../../streamTool/streamTool.js" ;
12+ import { AbortError } from "../../../util/AbortError.js" ;
1213import { isEmptyParagraph } from "../../../util/emptyBlock.js" ;
1314import { validateBlockArray } from "./util/validateBlockArray.js" ;
1415
@@ -269,9 +270,7 @@ export function createAddBlocksTool<T>(config: {
269270
270271 for ( const step of agentSteps ) {
271272 if ( abortSignal ?. aborted ) {
272- const error = new Error ( "Operation was aborted" ) ;
273- error . name = "AbortError" ;
274- throw error ;
273+ throw new AbortError ( "Operation was aborted" ) ;
275274 }
276275 if ( options . withDelays ) {
277276 await delayAgentStep ( step ) ;
Original file line number Diff line number Diff line change 99import { updateToReplaceSteps } from "../../../prosemirror/changeset.js" ;
1010import { RebaseTool } from "../../../prosemirror/rebaseTool.js" ;
1111import { Result , streamTool } from "../../../streamTool/streamTool.js" ;
12+ import { AbortError } from "../../../util/AbortError.js" ;
1213
1314export type UpdateBlockToolCall < T > = {
1415 type : "update" ;
@@ -245,9 +246,7 @@ export function createUpdateBlockTool<T>(config: {
245246
246247 for ( const step of agentSteps ) {
247248 if ( abortSignal ?. aborted ) {
248- const error = new Error ( "Operation was aborted" ) ;
249- error . name = "AbortError" ;
250- throw error ;
249+ throw new AbortError ( "Operation was aborted" ) ;
251250 }
252251 if ( options . withDelays ) {
253252 await delayAgentStep ( step ) ;
Original file line number Diff line number Diff line change 1+ export class AbortError extends Error {
2+ constructor (
3+ message : string ,
4+ options ?: { cause ?: unknown ; aborted ?: boolean } ,
5+ ) {
6+ super ( message , options ) ;
7+ this . name = "AbortError" ;
8+ }
9+ }
You can’t perform that action at this time.
0 commit comments