summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream-pipe-error-unhandled.js
blob: 42c1ce77fe48786f250f47ae0a3076d452da2c0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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'));