diff --git a/src/js/node/_http_client.ts b/src/js/node/_http_client.ts index d6299c2b80..d13bedf167 100644 --- a/src/js/node/_http_client.ts +++ b/src/js/node/_http_client.ts @@ -426,6 +426,10 @@ function ClientRequest(input, options, cb) { if (self.aborted || !self.emit("response", res)) { res._dump(); } + } catch (err) { + // Errors thrown by user's response handler should not crash the process + // This matches Node.js behavior + if (!!$debug) globalReportError(err); } finally { maybeEmitClose(); if (res.statusCode === 304) {