mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 13:28:42 +00:00

The stream will be destroyed upstream through the proper error flow. PR-URL: https://github.com/nodejs/node/pull/29179 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
24 lines
603 B
JavaScript
24 lines
603 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const JSStreamWrap = require('internal/js_stream_socket');
|
|
const { Duplex } = require('stream');
|
|
|
|
process.once('uncaughtException', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'exception!');
|
|
}));
|
|
|
|
const socket = new JSStreamWrap(new Duplex({
|
|
read: common.mustCall(),
|
|
write: common.mustCall((buffer, data, cb) => {
|
|
throw new Error('exception!');
|
|
})
|
|
}));
|
|
|
|
socket.end('foo');
|
|
socket.on('error', common.expectsError({
|
|
name: 'Error',
|
|
message: 'write EPROTO'
|
|
}));
|