mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

If the destination was an async function any error thrown from that function would be swallowed. PR-URL: https://github.com/nodejs/node/pull/31835 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
26 lines
568 B
JavaScript
26 lines
568 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const {
|
|
pipeline,
|
|
PassThrough
|
|
} = require('stream');
|
|
const assert = require('assert');
|
|
|
|
process.on('uncaughtException', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'error');
|
|
}));
|
|
|
|
// Ensure that pipeline that ends with Promise
|
|
// still propagates error to uncaughtException.
|
|
const s = new PassThrough();
|
|
s.end('data');
|
|
pipeline(s, async function(source) {
|
|
for await (const chunk of source) {
|
|
chunk;
|
|
}
|
|
}, common.mustCall((err) => {
|
|
assert.ifError(err);
|
|
throw new Error('error');
|
|
}));
|