diff options
Diffstat (limited to 'src/cdp/session.ts')
| -rw-r--r-- | src/cdp/session.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cdp/session.ts b/src/cdp/session.ts index fffa241..b1ae71c 100644 --- a/src/cdp/session.ts +++ b/src/cdp/session.ts @@ -45,7 +45,13 @@ export const createCdpSession = (transport: CdpTransport): CdpSession => { }; const restartConsumer = (): void => { - activeConsumer = activeConsumer.then(() => consumeEvents()).catch(() => undefined); + activeConsumer = activeConsumer.then(() => consumeEvents()).catch((e: unknown) => { + // The .then() chain calls consumeEvents() which iterates the transport's + // events() AsyncIterable. The iterable resolves cleanly on close (returns + // {done:true}); any rejection here is an unexpected bug in the event + // handler, not a normal termination. Surface it on stderr so it's not lost. + console.warn("[pi-browser-harness] CDP event consumer crashed:", e); + }); }; restartConsumer(); |
