NopN
Denoβ€’12mo agoβ€’
2 replies
Nop

QUIC QuicReceiveStream read() panics when peer disconnects

Deno panics when I'm waiting for a stream after the peer has disconnected.
The panic cannot be caught with a try/catch.

Code:
const reader = (await conn.incomingUnidirectionalStreams.getReader().read()).value.getReader();
while(true) {
  try {
    const msg = await reader.read();
  }catch(e) {
    console.error(e);
  }
}


Output:
NotConnected: connection lost
    at async Object.pull (ext:deno_web/06_streams.js:941:27) {
  name: "NotConnected",
  code: "ENOTCONN"
}
error: Uncaught (in promise) Error: timed out


Many thanks in advance. I really appreciate the new feature!
Was this page helpful?