From c786df3ff3730369985d77297049dca583a9b01a Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Thu, 28 Feb 2019 16:10:38 +0100 Subject: [PATCH] fix: dont emit error if aborted but complete Work-around a nodejs/node#18756 --- src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 799391b..19f3c6e 100644 --- a/src/index.js +++ b/src/index.js @@ -62,7 +62,10 @@ const pickDefined = (target, source, keys) => { }; function emitAbortedError() { - this.emit("error", new Cancel("aborted")); + // https://github.com/nodejs/node/issues/18756 + if (!this.complete) { + this.emit("error", new Cancel("aborted")); + } } const isString = value => typeof value === "string";