fix(pi-devin): observe errored stream cancel rejection in reader teardown

This commit is contained in:
Shujakuinkuraudo
2026-09-17 22:53:54 +08:00
committed by shujakuin
parent 654221119d
commit 624065c4f1
+5 -1
View File
@@ -400,7 +400,11 @@ async function* streamChatEvents(args: {
// ignore // ignore
} }
try { try {
void resp.body?.cancel(); // cancel() on an already-errored stream rejects with the stored
// error (e.g. undici TypeError("terminated") after the server drops
// the socket). try/catch cannot observe that rejection, so swallow
// it explicitly or it escapes as an uncaughtException and kills pi.
void resp.body?.cancel()?.catch(() => {});
} catch { } catch {
// ignore // ignore
} }