Custom waitFor timeout error

This commit is contained in:
2026-08-10 02:32:08 +00:00
parent 78311487a4
commit 296ab4aadf
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import type { DeeplyReadonly } from './types.ts';
import { WaitForTimeoutError } from './errors.ts';
import { deepFreeze } from './misc.ts';
export type EventMap = Record<string, unknown>;
@@ -213,7 +214,7 @@ export class EventEmitter<T extends EventMap> {
if (timeoutMs !== undefined) {
timeoutId = setTimeout(() => {
this.off(type, listener);
reject(new Error(`Timeout waiting for event "${String(type)}"`));
reject(new WaitForTimeoutError(String(type)));
}, timeoutMs);
}