Fix uncaught exceptions in net library (#10628)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run

Added missing error event handler
This commit is contained in:
Slayer95 2025-03-01 06:18:43 -05:00 committed by GitHub
parent 719bc1a87f
commit 674defa1b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,6 +98,9 @@ export class NetStream extends Streams.ReadWriteStream {
response.on('data', data => {
this.push(data);
});
response.on('error', error => {
if (!this.atEOF) this.pushError(error, true);
});
response.on('end', () => {
if (this.state === 'open') this.state = 'success';
if (!this.atEOF) this.pushEnd();