Just comments

This commit is contained in:
Mitra Ardron 2019-06-15 13:03:17 +10:00
parent 6469a01cc7
commit 43efb3f7b2

View File

@ -211,10 +211,12 @@ class TransportHTTP extends Transport {
through = new stream.PassThrough();
httptools.p_GET(this._url(url, servercommands.rawfetch), Object.assign({wantstream: true}, opts))
.then(s => s.pipe(through))
// Note any .catch is happening AFTER through returned
.catch(err => {
console.warn(this.name, "createReadStream caught error", err.message);
if (typeof through.destroy === 'function') {
through.destroy(err); // Will emit error & close and free up resources
// caller MUST implimit through.on('error', err=>) or will generate uncaught error message
} else {
through.emit('error', err);
}