From 2e1383d1e399211e3bb5bc1363fde2535bd78782 Mon Sep 17 00:00:00 2001 From: Kalin Krustev Date: Wed, 22 Nov 2023 14:03:55 +0100 Subject: [PATCH 1/2] fix #249 This attaches a catch handler to the handleContentP promise, as in some cases the flush is not called before node decides that this is an unhandled promise rejection. --- lib/content/write.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/content/write.js b/lib/content/write.js index 7146146..2884dbb 100644 --- a/lib/content/write.js +++ b/lib/content/write.js @@ -67,6 +67,7 @@ class CacacheWriteStream extends Flush { this.cache, this.opts ) + this.handleContentP.catch(error => this.destroy(error)) } return this.inputStream.write(chunk, encoding, cb) } From 632e6bc1e8a2775736dcba71cdec96db977b7a97 Mon Sep 17 00:00:00 2001 From: Kalin Krustev Date: Thu, 23 Nov 2023 08:48:17 +0100 Subject: [PATCH 2/2] fix: improve error handling --- lib/content/write.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/content/write.js b/lib/content/write.js index 2884dbb..09ca4e4 100644 --- a/lib/content/write.js +++ b/lib/content/write.js @@ -67,7 +67,7 @@ class CacacheWriteStream extends Flush { this.cache, this.opts ) - this.handleContentP.catch(error => this.destroy(error)) + this.handleContentP.catch(error => this.emit('error', error)) } return this.inputStream.write(chunk, encoding, cb) }