summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2019-10-01 23:59:59 +0200
committerRich Trott <rtrott@gmail.com>2019-10-13 16:38:15 -0700
commitf8f6a21580544146d5a8527333e1130b336dc094 (patch)
tree912f6bee87f4b7d48e164ea9b52e7b124d50b1fc /test
parentba45367830f6a5c73c20e64ee71265d3aa4af719 (diff)
downloadandroid-node-v8-f8f6a21580544146d5a8527333e1130b336dc094.tar.gz
android-node-v8-f8f6a21580544146d5a8527333e1130b336dc094.tar.bz2
android-node-v8-f8f6a21580544146d5a8527333e1130b336dc094.zip
stream: throw unhandled error for readable with autoDestroy
If autoDestroy then we should still throw on unhandled errors. PR-URL: https://github.com/nodejs/node/pull/29806 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Co-Authored-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-stream-pipe-error-unhandled.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/parallel/test-stream-pipe-error-unhandled.js b/test/parallel/test-stream-pipe-error-unhandled.js
new file mode 100644
index 0000000000..42c1ce77fe
--- /dev/null
+++ b/test/parallel/test-stream-pipe-error-unhandled.js
@@ -0,0 +1,21 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const { Readable, Writable } = require('stream');
+
+process.on('uncaughtException', common.mustCall((err) => {
+ assert.strictEqual(err.message, 'asd');
+}));
+
+const r = new Readable({
+ read() {
+ this.push('asd');
+ }
+});
+const w = new Writable({
+ autoDestroy: true,
+ write() {}
+});
+
+r.pipe(w);
+w.destroy(new Error('asd'));