From 4f831732e1921590cc983a4f726919c0d1dbf542 Mon Sep 17 00:00:00 2001 From: EYHN Date: Thu, 20 Feb 2025 10:32:02 +0000 Subject: [PATCH] fix(core): fix throw if aborted polyfill (#10321) --- blocksuite/framework/sync/src/utils/throw-if-aborted.ts | 2 +- packages/common/nbstore/src/utils/throw-if-aborted.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blocksuite/framework/sync/src/utils/throw-if-aborted.ts b/blocksuite/framework/sync/src/utils/throw-if-aborted.ts index 54e2c81ac9..c0a1ac98fd 100644 --- a/blocksuite/framework/sync/src/utils/throw-if-aborted.ts +++ b/blocksuite/framework/sync/src/utils/throw-if-aborted.ts @@ -1,7 +1,7 @@ // because AbortSignal.throwIfAborted is not available in abortcontroller-polyfill export function throwIfAborted(abort?: AbortSignal) { if (abort?.aborted) { - throw new Error(abort.reason); + throw abort.reason; } return true; } diff --git a/packages/common/nbstore/src/utils/throw-if-aborted.ts b/packages/common/nbstore/src/utils/throw-if-aborted.ts index 54e2c81ac9..c0a1ac98fd 100644 --- a/packages/common/nbstore/src/utils/throw-if-aborted.ts +++ b/packages/common/nbstore/src/utils/throw-if-aborted.ts @@ -1,7 +1,7 @@ // because AbortSignal.throwIfAborted is not available in abortcontroller-polyfill export function throwIfAborted(abort?: AbortSignal) { if (abort?.aborted) { - throw new Error(abort.reason); + throw abort.reason; } return true; }