fix(pi-devin): observe errored stream cancel rejection in reader teardown
This commit is contained in:
+5
-1
@@ -400,7 +400,11 @@ async function* streamChatEvents(args: {
|
||||
// ignore
|
||||
}
|
||||
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 {
|
||||
// ignore
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user