mirror of
https://github.com/fluencelabs/dweb-transports
synced 2025-03-15 18:30:49 +00:00
Just comments
This commit is contained in:
parent
6469a01cc7
commit
43efb3f7b2
@ -211,10 +211,12 @@ class TransportHTTP extends Transport {
|
|||||||
through = new stream.PassThrough();
|
through = new stream.PassThrough();
|
||||||
httptools.p_GET(this._url(url, servercommands.rawfetch), Object.assign({wantstream: true}, opts))
|
httptools.p_GET(this._url(url, servercommands.rawfetch), Object.assign({wantstream: true}, opts))
|
||||||
.then(s => s.pipe(through))
|
.then(s => s.pipe(through))
|
||||||
|
// Note any .catch is happening AFTER through returned
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.warn(this.name, "createReadStream caught error", err.message);
|
console.warn(this.name, "createReadStream caught error", err.message);
|
||||||
if (typeof through.destroy === 'function') {
|
if (typeof through.destroy === 'function') {
|
||||||
through.destroy(err); // Will emit error & close and free up resources
|
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 {
|
} else {
|
||||||
through.emit('error', err);
|
through.emit('error', err);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user