After thinking about this for a while I think we still should forward error events from the stream object. However, only if there is an event listener as to avoid uncaught errors.
function onStreamError(error) {
const request = this[kRequest];
if (request.hasListener('error')) {
request.emit('error', error);
}
}
Otherwise we end up with hacks like this:
const incoming = req.stream || req
incoming.on('error', errorHandler)
After thinking about this for a while I think we still should forward error events from the stream object. However, only if there is an event listener as to avoid uncaught errors.
Otherwise we end up with hacks like this: