diff --git a/.changeset/proud-horses-dream.md b/.changeset/proud-horses-dream.md new file mode 100644 index 00000000000..517da52fd04 --- /dev/null +++ b/.changeset/proud-horses-dream.md @@ -0,0 +1,5 @@ +--- +'@whatwg-node/disposablestack': patch +--- + +Ponyfill SuppressedError correctly inside DisposableStack ponyfills diff --git a/packages/disposablestack/src/AsyncDisposableStack.ts b/packages/disposablestack/src/AsyncDisposableStack.ts index 96f223a5673..128f3b48af4 100644 --- a/packages/disposablestack/src/AsyncDisposableStack.ts +++ b/packages/disposablestack/src/AsyncDisposableStack.ts @@ -1,6 +1,9 @@ +import { PonyfillSuppressedError } from './SupressedError.js'; import { DisposableSymbols } from './symbols.js'; import { isAsyncDisposable, isSyncDisposable, MaybePromise } from './utils.js'; +const SuppressedError = globalThis.SuppressedError || PonyfillSuppressedError; + export class PonyfillAsyncDisposableStack implements AsyncDisposableStack { private callbacks: (() => MaybePromise)[] = []; get disposed(): boolean { diff --git a/packages/disposablestack/src/DisposableStack.ts b/packages/disposablestack/src/DisposableStack.ts index 847b3ee89d7..d77e87e6134 100644 --- a/packages/disposablestack/src/DisposableStack.ts +++ b/packages/disposablestack/src/DisposableStack.ts @@ -1,6 +1,9 @@ +import { PonyfillSuppressedError } from './SupressedError.js'; import { DisposableSymbols } from './symbols.js'; import { isSyncDisposable } from './utils.js'; +const SuppressedError = globalThis.SuppressedError || PonyfillSuppressedError; + export class PonyfillDisposableStack implements DisposableStack { private callbacks: (() => void)[] = []; get disposed(): boolean {