Skip to content

Commit

Permalink
fix(disposablestack): handle missing SuppressedError
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Aug 28, 2024
1 parent 466bcda commit 860bfde
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-horses-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@whatwg-node/disposablestack': patch
---

Ponyfill SuppressedError correctly inside DisposableStack ponyfills
3 changes: 3 additions & 0 deletions packages/disposablestack/src/AsyncDisposableStack.ts
Original file line number Diff line number Diff line change
@@ -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<void>)[] = [];
get disposed(): boolean {
Expand Down
3 changes: 3 additions & 0 deletions packages/disposablestack/src/DisposableStack.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 860bfde

Please sign in to comment.